***04.052016 question content/format.

move Z2001rec Z2001
***droping variables in old format to avoid confusion
drop Z3036_1b Z3036_2b Z3036_3b Z3036_q1 Z3036_q1 Z3036_q2 Z3036_q3 question1 question2 question3 q1type q2type q3type Z_Qcontent

label variable PK "Political Knowledge"

generate Q_content=.
label variable Q_content "Question content"
label define content 1 "Persons" 2 "Party" 3 "Rules" 4 "Policy" 5 "Party position" 6 "Gender content" 7 "International" 8 "other"
label values Q_content content

generate Q_format=.
label variable Q_format "Question format"
label define format 0 "T/F" 1 "Multiple C" 2 "Open" 3 "Evaluation" 
label values Q_format format

generate Q_difficulty_1=.
label variable Q_difficulty_1 "Question difficulty version 1 percent responding correct"
generate Q_difficulty_2=.
label variable Q_difficulty_2 "Question difficulty cognitive ability 0-2"
label define diffic 0 "Numbers" 1 "Names" 2 "Words"
label values Q_difficulty_2 diffic
generate Q_difficulty_3=.
label variable Q_difficulty_3 "Question difficulty version 2 Gunning Fog Index"

***checking if my old coding matches, just for a few cases
*generate Q_format_old=.
*replace Q_format_old =question1 if _j==1
*replace Q_format_old =question2 if _j==2
*replace Q_format_old =question3 if _j==3
*recode Q_format_old (1=0)
*recode Q_format_old (2=1) 
*recode Q_format_old (3=2)

**JFR correction bits from 2019 20/1 run after everything!
***HK has the first item as 7, it should be 6
replace Q_content=6 if Z1004=="HKG_1998" &_j==1
replace Q_content=6 if Z1004=="HKG_2000" &_j==1 
***USA had a female politician
replace Q_content=6 if Z1004=="USA_2008" &_j==2
replace Q_content=3 if Z1004=="BEL_2003" &_j==3

***starting with module 1
*tab Z1004 if Z1001==1

replace Q_format=0 if  Z1004=="AUS_1996" &_j==1
replace Q_format=0 if  Z1004=="AUS_1996" &_j==2
replace Q_format=0 if  Z1004=="AUS_1996" &_j==3
replace Q_content=3 if Z1004=="AUS_1996" &_j==1
replace Q_content=3 if Z1004=="AUS_1996" &_j==2
replace Q_content=3 if Z1004=="AUS_1996" &_j==3
tab PK if Z1004=="AUS_1996" &_j==1
tab PK if Z1004=="AUS_1996" &_j==2
tab PK if Z1004=="AUS_1996" &_j==3
replace Q_difficulty_1=62.35  if Z1004=="AUS_1996" &_j==1
replace Q_difficulty_1=43.27  if Z1004=="AUS_1996" &_j==2
replace Q_difficulty_1=30.59  if Z1004=="AUS_1996" &_j==3
replace Q_difficulty_2=0  if Z1004=="AUS_1996" &_j==1
replace Q_difficulty_2=2  if Z1004=="AUS_1996" &_j==2
replace Q_difficulty_2=2  if Z1004=="AUS_1996" &_j==3
replace Q_difficulty_3=.  if Z1004=="AUS_1996" &_j==1
replace Q_difficulty_3=.  if Z1004=="AUS_1996" &_j==2
replace Q_difficulty_3=.  if Z1004=="AUS_1996" &_j==3
**note Australia offered DK in the questionnaire but not in the answers provided in the cSES, they are missing
**according to the codebook.
**this explains why missings increase from one question to the next.

replace Q_format=2 if  Z1004=="BELF1999" &_j==1
replace Q_format=1 if  Z1004=="BELF1999" &_j==2
replace Q_format=2 if  Z1004=="BELF1999" &_j==3
replace Q_content=1 if Z1004=="BELF1999" &_j==1
replace Q_content=5 if Z1004=="BELF1999" &_j==2
replace Q_content=7 if Z1004=="BELF1999" &_j==3
tab PK if Z1004=="BELF1999" &_j==1
tab PK if Z1004=="BELF1999" &_j==2
tab PK if Z1004=="BELF1999" &_j==3
replace Q_difficulty_1=65.99  if Z1004=="BELF1999" &_j==1
replace Q_difficulty_1=44.7  if Z1004=="BELF1999" &_j==2
replace Q_difficulty_1=23.4  if Z1004=="BELF1999" &_j==3
replace Q_difficulty_2=1  if Z1004=="BELF1999" &_j==1
replace Q_difficulty_2=1  if Z1004=="BELF1999" &_j==2
replace Q_difficulty_2=1  if Z1004=="BELF1999" &_j==3
replace Q_difficulty_3=.  if Z1004=="BELF1999" &_j==1
replace Q_difficulty_3=.  if Z1004=="BELF1999" &_j==2
replace Q_difficulty_3=.  if Z1004=="BELF1999" &_j==3

replace Q_format=2 if  Z1004=="BELW1999" &_j==1
replace Q_format=1 if  Z1004=="BELW1999" &_j==2
replace Q_format=2 if  Z1004=="BELW1999" &_j==3
replace Q_content=1 if Z1004=="BELW1999" &_j==1
replace Q_content=5 if Z1004=="BELW1999" &_j==2
replace Q_content=7 if Z1004=="BELW1999" &_j==3
tab PK if Z1004=="BELW1999" &_j==1
tab PK if Z1004=="BELW1999" &_j==2
tab PK if Z1004=="BELW1999" &_j==3
replace Q_difficulty_1=73.27  if Z1004=="BELW1999" &_j==1
replace Q_difficulty_1=38.98  if Z1004=="BELW1999" &_j==2
replace Q_difficulty_1=27.76  if Z1004=="BELW1999" &_j==3
replace Q_difficulty_2=1  if Z1004=="BELW1999" &_j==1
replace Q_difficulty_2=1  if Z1004=="BELW1999" &_j==2
replace Q_difficulty_2=1  if Z1004=="BELW1999" &_j==3
replace Q_difficulty_3=.  if Z1004=="BELW1999" &_j==1
replace Q_difficulty_3=.  if Z1004=="BELW1999" &_j==2
replace Q_difficulty_3=.  if Z1004=="BELW1999" &_j==3
**making the assumption that Wallonia submitted the same Qs as Flanders (same battery in questionnaire, which just dont know which are the final ones)
***large amounts go missing here!! DK likely coded as missing. 

replace Q_format=2 if  Z1004=="CAN_1997" &_j==1
replace Q_format=2 if  Z1004=="CAN_1997" &_j==2
replace Q_format=2 if  Z1004=="CAN_1997" &_j==3
replace Q_content=1 if Z1004=="CAN_1997" &_j==1
replace Q_content=6 if Z1004=="CAN_1997" &_j==2
replace Q_content=1 if Z1004=="CAN_1997" &_j==3
tab PK if Z1004=="CAN_1997" &_j==1
tab PK if Z1004=="CAN_1997" &_j==2
tab PK if Z1004=="CAN_1997" &_j==3
replace Q_difficulty_1=84.87  if Z1004=="CAN_1997" &_j==1
replace Q_difficulty_1=47.49  if Z1004=="CAN_1997" &_j==2
replace Q_difficulty_1=45.49  if Z1004=="CAN_1997" &_j==3
replace Q_difficulty_2=1  if Z1004=="CAN_1997" &_j==1
replace Q_difficulty_2=1  if Z1004=="CAN_1997" &_j==2
replace Q_difficulty_2=1  if Z1004=="CAN_1997" &_j==3
replace Q_difficulty_3=.  if Z1004=="CAN_1997" &_j==1
replace Q_difficulty_3=.  if Z1004=="CAN_1997" &_j==2
replace Q_difficulty_3=.  if Z1004=="CAN_1997" &_j==3
**Question format not explicit in Questionnaire, make assumption of open ended.

replace Q_format=2 if  Z1004=="CHE_1999" &_j==1
replace Q_format=2 if  Z1004=="CHE_1999" &_j==2
replace Q_format=2 if  Z1004=="CHE_1999" &_j==3
replace Q_content=1 if Z1004=="CHE_1999" &_j==1
replace Q_content=2 if Z1004=="CHE_1999" &_j==2
replace Q_content=3 if Z1004=="CHE_1999" &_j==3
tab PK if Z1004=="CHE_1999" &_j==1
tab PK if Z1004=="CHE_1999" &_j==2
tab PK if Z1004=="CHE_1999" &_j==3
replace Q_difficulty_1=65.63  if Z1004=="CHE_1999" &_j==1
replace Q_difficulty_1=47.80  if Z1004=="CHE_1999" &_j==2
replace Q_difficulty_1=36.72  if Z1004=="CHE_1999" &_j==3
replace Q_difficulty_2=1  if Z1004=="CHE_1999" &_j==1
replace Q_difficulty_2=0  if Z1004=="CHE_1999" &_j==2
replace Q_difficulty_2=0  if Z1004=="CHE_1999" &_j==3
replace Q_difficulty_3=12  if Z1004=="CHE_1999" &_j==1
replace Q_difficulty_3=16.93  if Z1004=="CHE_1999" &_j==2
replace Q_difficulty_3=21.38  if Z1004=="CHE_1999" &_j==3

replace Q_format=2 if  Z1004=="CZE_1996" &_j==1
replace Q_format=2 if  Z1004=="CZE_1996" &_j==2
replace Q_format=2 if  Z1004=="CZE_1996" &_j==3
replace Q_content=3 if Z1004=="CZE_1996" &_j==1
replace Q_content=1 if Z1004=="CZE_1996" &_j==2
replace Q_content=3 if Z1004=="CZE_1996" &_j==3
tab PK if Z1004=="CZE_1996" &_j==1
tab PK if Z1004=="CZE_1996" &_j==2
tab PK if Z1004=="CZE_1996" &_j==3
replace Q_difficulty_1=71.77  if Z1004=="CZE_1996" &_j==1
replace Q_difficulty_1=58.67  if Z1004=="CZE_1996" &_j==2
replace Q_difficulty_1=56.55  if Z1004=="CZE_1996" &_j==3
replace Q_difficulty_2=0 if Z1004=="CZE_1996" &_j==1
replace Q_difficulty_2=1  if Z1004=="CZE_1996" &_j==2
replace Q_difficulty_2=0  if Z1004=="CZE_1996" &_j==3
replace Q_difficulty_3=15.49 if Z1004=="CZE_1996" &_j==1
replace Q_difficulty_3=16  if Z1004=="CZE_1996" &_j==2
replace Q_difficulty_3=9.067  if Z1004=="CZE_1996" &_j==3
***losing a bit of missings here

replace Q_format=2 if  Z1004=="DEU_1998" &_j==1
replace Q_format=2 if  Z1004=="DEU_1998" &_j==2
replace Q_format=2 if  Z1004=="DEU_1998" &_j==3
replace Q_content=1 if Z1004=="DEU_1998" &_j==1
replace Q_content=3 if Z1004=="DEU_1998" &_j==2
replace Q_content=7 if Z1004=="DEU_1998" &_j==3
tab PK if Z1004=="DEU_1998" &_j==1
tab PK if Z1004=="DEU_1998" &_j==2
tab PK if Z1004=="DEU_1998" &_j==3
replace Q_difficulty_1=66.52  if Z1004=="DEU_1998" &_j==1
replace Q_difficulty_1=44.48  if Z1004=="DEU_1998" &_j==2
replace Q_difficulty_1=11.14  if Z1004=="DEU_1998" &_j==3
replace Q_difficulty_2=1  if Z1004=="DEU_1998" &_j==1
replace Q_difficulty_2=0  if Z1004=="DEU_1998" &_j==2
replace Q_difficulty_2=0  if Z1004=="DEU_1998" &_j==3
replace Q_difficulty_3=.  if Z1004=="DEU_1998" &_j==1
replace Q_difficulty_3=.  if Z1004=="DEU_1998" &_j==2
replace Q_difficulty_3=.  if Z1004=="DEU_1998" &_j==3

replace Q_format=2 if  Z1004=="ESP_1996" &_j==1
replace Q_format=2 if  Z1004=="ESP_1996" &_j==2
replace Q_format=2 if  Z1004=="ESP_1996" &_j==3
replace Q_content=7 if Z1004=="ESP_1996" &_j==1
replace Q_content=3 if Z1004=="ESP_1996" &_j==2
replace Q_content=1 if Z1004=="ESP_1996" &_j==3
tab PK if Z1004=="ESP_1996" &_j==1
tab PK if Z1004=="ESP_1996" &_j==2
tab PK if Z1004=="ESP_1996" &_j==3
replace Q_difficulty_1=61.55  if Z1004=="ESP_1996" &_j==1
replace Q_difficulty_1=55.36  if Z1004=="ESP_1996" &_j==2
replace Q_difficulty_1=35.81  if Z1004=="ESP_1996" &_j==3
replace Q_difficulty_2=0  if Z1004=="ESP_1996" &_j==1
replace Q_difficulty_2=0  if Z1004=="ESP_1996" &_j==2
replace Q_difficulty_2=1  if Z1004=="ESP_1996" &_j==3
replace Q_difficulty_3=8.2  if Z1004=="ESP_1996" &_j==1
replace Q_difficulty_3=2.8  if Z1004=="ESP_1996" &_j==2
replace Q_difficulty_3=14.17  if Z1004=="ESP_1996" &_j==3

replace Q_format=2 if  Z1004=="ESP_2000" &_j==1
replace Q_format=2 if  Z1004=="ESP_2000" &_j==2
replace Q_format=2 if  Z1004=="ESP_2000" &_j==3
replace Q_content=7 if Z1004=="ESP_2000" &_j==1
replace Q_content=3 if Z1004=="ESP_2000" &_j==2
replace Q_content=1 if Z1004=="ESP_2000" &_j==3
tab PK if Z1004=="ESP_2000" &_j==1
tab PK if Z1004=="ESP_2000" &_j==2
tab PK if Z1004=="ESP_2000" &_j==3
replace Q_difficulty_1=96.03  if Z1004=="ESP_2000" &_j==1
replace Q_difficulty_1=30.46  if Z1004=="ESP_2000" &_j==2
replace Q_difficulty_1=26.57  if Z1004=="ESP_2000" &_j==3
replace Q_difficulty_2=0  if Z1004=="ESP_2000" &_j==1
replace Q_difficulty_2=0  if Z1004=="ESP_2000" &_j==2
replace Q_difficulty_2=1  if Z1004=="ESP_2000" &_j==3
replace Q_difficulty_3=8.2  if Z1004=="ESP_2000" &_j==1
replace Q_difficulty_3=2.8  if Z1004=="ESP_2000" &_j==2
replace Q_difficulty_3=14.17  if Z1004=="ESP_2000" &_j==3

replace Q_format=0 if  Z1004=="GBR_1997" &_j==1
replace Q_format=0 if  Z1004=="GBR_1997" &_j==2
replace Q_format=0 if  Z1004=="GBR_1997" &_j==3
replace Q_content=3 if Z1004=="GBR_1997" &_j==1
replace Q_content=3 if Z1004=="GBR_1997" &_j==2
replace Q_content=3 if Z1004=="GBR_1997" &_j==3
tab PK if Z1004=="GBR_1997" &_j==1
tab PK if Z1004=="GBR_1997" &_j==2
tab PK if Z1004=="GBR_1997" &_j==3
replace Q_difficulty_1=70.56  if Z1004=="GBR_1997" &_j==1
replace Q_difficulty_1=63.58  if Z1004=="GBR_1997" &_j==2
replace Q_difficulty_1=56.96  if Z1004=="GBR_1997" &_j==3
replace Q_difficulty_2=1  if Z1004=="GBR_1997" &_j==1
replace Q_difficulty_2=0  if Z1004=="GBR_1997" &_j==2
replace Q_difficulty_2=2  if Z1004=="GBR_1997" &_j==3
replace Q_difficulty_3=18.2  if Z1004=="GBR_1997" &_j==1
replace Q_difficulty_3=12  if Z1004=="GBR_1997" &_j==2
replace Q_difficulty_3=18.2  if Z1004=="GBR_1997" &_j==3

replace Q_format=0 if  Z1004=="HKG_1998" &_j==1
replace Q_format=0 if  Z1004=="HKG_1998" &_j==2
replace Q_format=0 if  Z1004=="HKG_1998" &_j==3
replace Q_content=7 if Z1004=="HKG_1998" &_j==1
replace Q_content=3 if Z1004=="HKG_1998" &_j==2
replace Q_content=3 if Z1004=="HKG_1998" &_j==3
tab PK if Z1004=="HKG_1998" &_j==1
tab PK if Z1004=="HKG_1998" &_j==2
tab PK if Z1004=="HKG_1998" &_j==3
replace Q_difficulty_1=88.2  if Z1004=="HKG_1998" &_j==1
replace Q_difficulty_1=55.7  if Z1004=="HKG_1998" &_j==2
replace Q_difficulty_1=42.2  if Z1004=="HKG_1998" &_j==3
replace Q_difficulty_2=1  if Z1004=="HKG_1998" &_j==1
replace Q_difficulty_2=0  if Z1004=="HKG_1998" &_j==2
replace Q_difficulty_2=2  if Z1004=="HKG_1998" &_j==3
replace Q_difficulty_3=8.044  if Z1004=="HKG_1998" &_j==1
replace Q_difficulty_3=17.51  if Z1004=="HKG_1998" &_j==2
replace Q_difficulty_3=11.47  if Z1004=="HKG_1998" &_j==3

replace Q_format=0 if  Z1004=="HKG_2000" &_j==1
replace Q_format=0 if  Z1004=="HKG_2000" &_j==2
replace Q_format=0 if  Z1004=="HKG_2000" &_j==3
replace Q_content=7 if Z1004=="HKG_2000" &_j==1
replace Q_content=3 if Z1004=="HKG_2000" &_j==2
replace Q_content=3 if Z1004=="HKG_2000" &_j==3
tab PK if Z1004=="HKG_2000" &_j==1
tab PK if Z1004=="HKG_2000" &_j==2
tab PK if Z1004=="HKG_2000" &_j==3
replace Q_difficulty_1=88.58  if Z1004=="HKG_2000" &_j==1
replace Q_difficulty_1=50.74  if Z1004=="HKG_2000" &_j==2
replace Q_difficulty_1=35.01  if Z1004=="HKG_2000" &_j==3
replace Q_difficulty_2=1  if Z1004=="HKG_2000" &_j==1
replace Q_difficulty_2=0  if Z1004=="HKG_2000" &_j==2
replace Q_difficulty_2=2  if Z1004=="HKG_2000" &_j==3
replace Q_difficulty_3=8.044  if Z1004=="HKG_2000" &_j==1
replace Q_difficulty_3=17.51  if Z1004=="HKG_2000" &_j==2
replace Q_difficulty_3=11.47  if Z1004=="HKG_2000" &_j==3

replace Q_format=3 if  Z1004=="HUN_1998" &_j==1
replace Q_format=2 if  Z1004=="HUN_1998" &_j==2
replace Q_format=2 if  Z1004=="HUN_1998" &_j==3
replace Q_content=8 if Z1004=="HUN_1998" &_j==1
replace Q_content=3 if Z1004=="HUN_1998" &_j==2
replace Q_content=1 if Z1004=="HUN_1998" &_j==3
tab PK if Z1004=="HUN_1998" &_j==1
tab PK if Z1004=="HUN_1998" &_j==2
tab PK if Z1004=="HUN_1998" &_j==3
replace Q_difficulty_1=65.26  if Z1004=="HUN_1998" &_j==1
replace Q_difficulty_1=34.43  if Z1004=="HUN_1998" &_j==2
replace Q_difficulty_1=23.08  if Z1004=="HUN_1998" &_j==3
replace Q_difficulty_2=.  if Z1004=="HUN_1998" &_j==1
replace Q_difficulty_2=0  if Z1004=="HUN_1998" &_j==2
replace Q_difficulty_2=1  if Z1004=="HUN_1998" &_j==3
replace Q_difficulty_3=.  if Z1004=="HUN_1998" &_j==1
replace Q_difficulty_3=21.2  if Z1004=="HUN_1998" &_j==2
replace Q_difficulty_3=18.5  if Z1004=="HUN_1998" &_j==3

replace Q_format=2 if  Z1004=="ISR_1996" &_j==1
replace Q_format=2 if  Z1004=="ISR_1996" &_j==2
replace Q_format=2 if  Z1004=="ISR_1996" &_j==3
replace Q_content=3 if Z1004=="ISR_1996" &_j==1
replace Q_content=1 if Z1004=="ISR_1996" &_j==2
replace Q_content=4 if Z1004=="ISR_1996" &_j==3
tab PK if Z1004=="ISR_1996" &_j==1
tab PK if Z1004=="ISR_1996" &_j==2
tab PK if Z1004=="ISR_1996" &_j==3
replace Q_difficulty_1=36.02  if Z1004=="ISR_1996" &_j==1
replace Q_difficulty_1=30.61  if Z1004=="ISR_1996" &_j==2
replace Q_difficulty_1=27.13  if Z1004=="ISR_1996" &_j==3
replace Q_difficulty_2=0  if Z1004=="ISR_1996" &_j==1
replace Q_difficulty_2=1  if Z1004=="ISR_1996" &_j==2
replace Q_difficulty_2=0  if Z1004=="ISR_1996" &_j==3
replace Q_difficulty_3=11.6  if Z1004=="ISR_1996" &_j==1
replace Q_difficulty_3=5.2   if Z1004=="ISR_1996" &_j==2
replace Q_difficulty_3=9.153 if Z1004=="ISR_1996" &_j==3
***we lose many missings here since the 999 is large. this might be worth recoding to incorrect

replace Q_format=0 if  Z1004=="JPN_1996" &_j==1
replace Q_format=2 if  Z1004=="JPN_1996" &_j==2
replace Q_format=. if  Z1004=="JPN_1996" &_j==3
replace Q_content=3 if Z1004=="JPN_1996" &_j==1
replace Q_content=3 if Z1004=="JPN_1996" &_j==2
replace Q_content=. if Z1004=="JPN_1996" &_j==3
tab PK if Z1004=="JPN_1996" &_j==1
tab PK if Z1004=="JPN_1996" &_j==2
tab PK if Z1004=="JPN_1996" &_j==3
replace Q_difficulty_1=39.41  if Z1004=="JPN_1996" &_j==1
replace Q_difficulty_1=12.96  if Z1004=="JPN_1996" &_j==2
replace Q_difficulty_1=.  if Z1004=="JPN_1996" &_j==3
replace Q_difficulty_2=2  if Z1004=="JPN_1996" &_j==1
replace Q_difficulty_2=2  if Z1004=="JPN_1996" &_j==2
replace Q_difficulty_2=.  if Z1004=="JPN_1996" &_j==3
replace Q_difficulty_3=11.31  if Z1004=="JPN_1996" &_j==1
replace Q_difficulty_3=5.836  if Z1004=="JPN_1996" &_j==2
replace Q_difficulty_3=.  if Z1004=="JPN_1996" &_j==3
***japan has only 2 items.

replace Q_format=2 if  Z1004=="MEX_1997" &_j==1
replace Q_format=2 if  Z1004=="MEX_1997" &_j==2
replace Q_format=2 if  Z1004=="MEX_1997" &_j==3
replace Q_content=1 if Z1004=="MEX_1997" &_j==1
replace Q_content=3 if Z1004=="MEX_1997" &_j==2
replace Q_content=3 if Z1004=="MEX_1997" &_j==3
tab PK if Z1004=="MEX_1997" &_j==1
tab PK if Z1004=="MEX_1997" &_j==2
tab PK if Z1004=="MEX_1997" &_j==3
replace Q_difficulty_1=88.49  if Z1004=="MEX_1997" &_j==1
replace Q_difficulty_1=53.76  if Z1004=="MEX_1997" &_j==2
replace Q_difficulty_1=38.32  if Z1004=="MEX_1997" &_j==3
replace Q_difficulty_2=1  if Z1004=="MEX_1997" &_j==1
replace Q_difficulty_2=0  if Z1004=="MEX_1997" &_j==2
replace Q_difficulty_2=0  if Z1004=="MEX_1997" &_j==3
replace Q_difficulty_3=14.43  if Z1004=="MEX_1997" &_j==1
replace Q_difficulty_3=11.67  if Z1004=="MEX_1997" &_j==2
replace Q_difficulty_3=8.667  if Z1004=="MEX_1997" &_j==3
***Mexico is has differences between CSES and its own questionnaires! one ! is different
***interim decision, stick with Mexican Q.

replace Q_format=2 if  Z1004=="MEX_2000" &_j==1
replace Q_format=2 if  Z1004=="MEX_2000" &_j==2
replace Q_format=2 if  Z1004=="MEX_2000" &_j==3
replace Q_content=1 if Z1004=="MEX_2000" &_j==1
replace Q_content=3 if Z1004=="MEX_2000" &_j==2
replace Q_content=3 if Z1004=="MEX_2000" &_j==3
tab PK if Z1004=="MEX_2000" &_j==1
tab PK if Z1004=="MEX_2000" &_j==2
tab PK if Z1004=="MEX_2000" &_j==3
replace Q_difficulty_1=65.29  if Z1004=="MEX_2000" &_j==1
replace Q_difficulty_1=44.68  if Z1004=="MEX_2000" &_j==2
replace Q_difficulty_1=41.85  if Z1004=="MEX_2000" &_j==3
replace Q_difficulty_2=1  if Z1004=="MEX_2000" &_j==1
replace Q_difficulty_2=0  if Z1004=="MEX_2000" &_j==2
replace Q_difficulty_2=0  if Z1004=="MEX_2000" &_j==3
replace Q_difficulty_3=14.43  if Z1004=="MEX_2000" &_j==1
replace Q_difficulty_3=11.67  if Z1004=="MEX_2000" &_j==2
replace Q_difficulty_3=8.667  if Z1004=="MEX_2000" &_j==3
***Mexico is has differences between CSES and its own questionnaires! one ! is different
***interim decision, stick with Mexican Q.

replace Q_format=0 if  Z1004=="NLD_1998" &_j==1
replace Q_format=0 if  Z1004=="NLD_1998" &_j==2
replace Q_format=2 if  Z1004=="NLD_1998" &_j==3
replace Q_content=2 if Z1004=="NLD_1998" &_j==1
replace Q_content=7 if Z1004=="NLD_1998" &_j==2
replace Q_content=1 if Z1004=="NLD_1998" &_j==3
tab PK if Z1004=="NLD_1998" &_j==1
tab PK if Z1004=="NLD_1998" &_j==2
tab PK if Z1004=="NLD_1998" &_j==3
replace Q_difficulty_1=70.49  if Z1004=="NLD_1998" &_j==1
replace Q_difficulty_1=47.55  if Z1004=="NLD_1998" &_j==2
replace Q_difficulty_1=33.51  if Z1004=="NLD_1998" &_j==3
replace Q_difficulty_2=2  if Z1004=="NLD_1998" &_j==1
replace Q_difficulty_2=2  if Z1004=="NLD_1998" &_j==2
replace Q_difficulty_2=1  if Z1004=="NLD_1998" &_j==3
replace Q_difficulty_3=8.514  if Z1004=="NLD_1998" &_j==1
replace Q_difficulty_3=8.2  if Z1004=="NLD_1998" &_j==2
replace Q_difficulty_3=8.514  if Z1004=="NLD_1998" &_j==3

replace Q_format=2 if  Z1004=="NOR_1997" &_j==1
replace Q_format=2 if  Z1004=="NOR_1997" &_j==2
replace Q_format=2 if  Z1004=="NOR_1997" &_j==3
replace Q_content=2 if Z1004=="NOR_1997" &_j==1
replace Q_content=3 if Z1004=="NOR_1997" &_j==2
replace Q_content=1 if Z1004=="NOR_1997" &_j==3
tab PK if Z1004=="NOR_1997" &_j==1
tab PK if Z1004=="NOR_1997" &_j==2
tab PK if Z1004=="NOR_1997" &_j==3
replace Q_difficulty_1=77.47  if Z1004=="NOR_1997" &_j==1
replace Q_difficulty_1=36.06  if Z1004=="NOR_1997" &_j==2
replace Q_difficulty_1=28.81  if Z1004=="NOR_1997" &_j==3
replace Q_difficulty_2=2  if Z1004=="NOR_1997" &_j==1
replace Q_difficulty_2=0  if Z1004=="NOR_1997" &_j==2
replace Q_difficulty_2=1  if Z1004=="NOR_1997" &_j==3
replace Q_difficulty_3=8.667  if Z1004=="NOR_1997" &_j==1
replace Q_difficulty_3=8.2  if Z1004=="NOR_1997" &_j==2
replace Q_difficulty_3=16.21  if Z1004=="NOR_1997" &_j==3
**missings here

replace Q_format=0 if  Z1004=="NZL_1996" &_j==1
replace Q_format=0 if  Z1004=="NZL_1996" &_j==2
replace Q_format=0 if  Z1004=="NZL_1996" &_j==3
replace Q_content=3 if Z1004=="NZL_1996" &_j==1
replace Q_content=3 if Z1004=="NZL_1996" &_j==2
replace Q_content=3 if Z1004=="NZL_1996" &_j==3
tab PK if Z1004=="NZL_1996" &_j==1
tab PK if Z1004=="NZL_1996" &_j==2
tab PK if Z1004=="NZL_1996" &_j==3
replace Q_difficulty_1=70.49  if Z1004=="NZL_1996" &_j==1
replace Q_difficulty_1=64.75  if Z1004=="NZL_1996" &_j==2
replace Q_difficulty_1=33.36  if Z1004=="NZL_1996" &_j==3
replace Q_difficulty_2=2  if Z1004=="NZL_1996" &_j==1
replace Q_difficulty_2=0  if Z1004=="NZL_1996" &_j==2
replace Q_difficulty_2=2  if Z1004=="NZL_1996" &_j==3
replace Q_difficulty_3=18  if Z1004=="NZL_1996" &_j==1
replace Q_difficulty_3=9.067  if Z1004=="NZL_1996" &_j==2
replace Q_difficulty_3=8  if Z1004=="NZL_1996" &_j==3

replace Q_format=2 if  Z1004=="POL_1997" &_j==1
replace Q_format=2 if  Z1004=="POL_1997" &_j==2
replace Q_format=2 if  Z1004=="POL_1997" &_j==3
replace Q_content=1 if Z1004=="POL_1997" &_j==1
replace Q_content=2 if Z1004=="POL_1997" &_j==2
replace Q_content=7 if Z1004=="POL_1997" &_j==3
tab PK if Z1004=="POL_1997" &_j==1
tab PK if Z1004=="POL_1997" &_j==2
tab PK if Z1004=="POL_1997" &_j==3
replace Q_difficulty_1=70.04  if Z1004=="POL_1997" &_j==1
replace Q_difficulty_1=66.20  if Z1004=="POL_1997" &_j==2
replace Q_difficulty_1=40.09  if Z1004=="POL_1997" &_j==3
replace Q_difficulty_2=1  if Z1004=="POL_1997" &_j==1
replace Q_difficulty_2=2  if Z1004=="POL_1997" &_j==2
replace Q_difficulty_2=2  if Z1004=="POL_1997" &_j==3
replace Q_difficulty_3=15.31  if Z1004=="POL_1997" &_j==1
replace Q_difficulty_3=18.13  if Z1004=="POL_1997" &_j==2
replace Q_difficulty_3=13.2  if Z1004=="POL_1997" &_j==3

replace Q_format=2 if  Z1004=="PRT_2002" &_j==1
replace Q_format=2 if  Z1004=="PRT_2002" &_j==2
replace Q_format=2 if  Z1004=="PRT_2002" &_j==3
replace Q_content=1 if Z1004=="PRT_2002" &_j==1
replace Q_content=7 if Z1004=="PRT_2002" &_j==2
replace Q_content=1 if Z1004=="PRT_2002" &_j==3
tab PK if Z1004=="PRT_2002" &_j==1
tab PK if Z1004=="PRT_2002" &_j==2
tab PK if Z1004=="PRT_2002" &_j==3
replace Q_difficulty_1=81.81  if Z1004=="PRT_2002" &_j==1
replace Q_difficulty_1=39.91  if Z1004=="PRT_2002" &_j==2
replace Q_difficulty_1=19.03  if Z1004=="PRT_2002" &_j==3
replace Q_difficulty_2=1  if Z1004=="PRT_2002" &_j==1
replace Q_difficulty_2=0  if Z1004=="PRT_2002" &_j==2
replace Q_difficulty_2=1  if Z1004=="PRT_2002" &_j==3
replace Q_difficulty_3=12.49  if Z1004=="PRT_2002" &_j==1
replace Q_difficulty_3=16  if Z1004=="PRT_2002" &_j==2
replace Q_difficulty_3=15.46  if Z1004=="PRT_2002" &_j==3

replace Q_format=1 if  Z1004=="ROU_1996" &_j==1
replace Q_format=2 if  Z1004=="ROU_1996" &_j==2
replace Q_format=. if  Z1004=="ROU_1996" &_j==3
replace Q_content=5 if Z1004=="ROU_1996" &_j==1
replace Q_content=2 if Z1004=="ROU_1996" &_j==2
replace Q_content=. if Z1004=="ROU_1996" &_j==3
tab PK if Z1004=="ROU_1996" &_j==1
tab PK if Z1004=="ROU_1996" &_j==2
tab PK if Z1004=="ROU_1996" &_j==3
replace Q_difficulty_1=56.6  if Z1004=="ROU_1996" &_j==1
replace Q_difficulty_1=44.47  if Z1004=="ROU_1996" &_j==2
replace Q_difficulty_1=31.15  if Z1004=="ROU_1996" &_j==3
replace Q_difficulty_2=2  if Z1004=="ROU_1996" &_j==1
replace Q_difficulty_2=2  if Z1004=="ROU_1996" &_j==2
replace Q_difficulty_2=. if Z1004=="ROU_1996" &_j==3
replace Q_difficulty_3=14.37  if Z1004=="ROU_1996" &_j==1
replace Q_difficulty_3=10.3  if Z1004=="ROU_1996" &_j==2
replace Q_difficulty_3=. if Z1004=="ROU_1996" &_j==3
***missing cases here
***ROM with only 2 items in the codebook, the third is completely unknown

replace Q_format=0 if  Z1004=="SWE_1998" &_j==1
replace Q_format=2 if  Z1004=="SWE_1998" &_j==2
replace Q_format=2 if  Z1004=="SWE_1998" &_j==3
replace Q_content=3 if Z1004=="SWE_1998" &_j==1
replace Q_content=2 if Z1004=="SWE_1998" &_j==2
replace Q_content=6 if Z1004=="SWE_1998" &_j==3
tab PK if Z1004=="SWE_1998" &_j==1
tab PK if Z1004=="SWE_1998" &_j==2
tab PK if Z1004=="SWE_1998" &_j==3
replace Q_difficulty_1=59.38  if Z1004=="SWE_1998" &_j==1
replace Q_difficulty_1=44.77  if Z1004=="SWE_1998" &_j==2
replace Q_difficulty_1=31.89  if Z1004=="SWE_1998" &_j==3
replace Q_difficulty_2=0  if Z1004=="SWE_1998" &_j==1
replace Q_difficulty_2=1  if Z1004=="SWE_1998" &_j==2
replace Q_difficulty_2=1  if Z1004=="SWE_1998" &_j==3
replace Q_difficulty_3=2.4  if Z1004=="SWE_1998" &_j==1
replace Q_difficulty_3=6.61  if Z1004=="SWE_1998" &_j==2
replace Q_difficulty_3=6.61  if Z1004=="SWE_1998" &_j==3

replace Q_format=2 if  Z1004=="TWN_1996" &_j==1
replace Q_format=2 if  Z1004=="TWN_1996" &_j==2
replace Q_format=2 if  Z1004=="TWN_1996" &_j==3
replace Q_content=1 if Z1004=="TWN_1996" &_j==1
replace Q_content=1 if Z1004=="TWN_1996" &_j==2
replace Q_content=1 if Z1004=="TWN_1996" &_j==3
tab PK if Z1004=="TWN_1996" &_j==1
tab PK if Z1004=="TWN_1996" &_j==2
tab PK if Z1004=="TWN_1996" &_j==3
replace Q_difficulty_1=70.75  if Z1004=="TWN_1996" &_j==1
replace Q_difficulty_1=56.42  if Z1004=="TWN_1996" &_j==2
replace Q_difficulty_1=45.42  if Z1004=="TWN_1996" &_j==3
replace Q_difficulty_2=1  if Z1004=="TWN_1996" &_j==1
replace Q_difficulty_2=1  if Z1004=="TWN_1996" &_j==2
replace Q_difficulty_2=1  if Z1004=="TWN_1996" &_j==3
replace Q_difficulty_3=11.6  if Z1004=="TWN_1996" &_j==1
replace Q_difficulty_3=2.8  if Z1004=="TWN_1996" &_j==2
replace Q_difficulty_3=13.2  if Z1004=="TWN_1996" &_j==3

replace Q_format=2 if  Z1004=="UKR_1998" &_j==1
replace Q_format=0 if  Z1004=="UKR_1998" &_j==2
replace Q_format=2 if  Z1004=="UKR_1998" &_j==3
replace Q_content=3 if Z1004=="UKR_1998" &_j==1
replace Q_content=7 if Z1004=="UKR_1998" &_j==2
replace Q_content=1 if Z1004=="UKR_1998" &_j==3
tab PK if Z1004=="UKR_1998" &_j==1
tab PK if Z1004=="UKR_1998" &_j==2
tab PK if Z1004=="UKR_1998" &_j==3
replace Q_difficulty_1=91.64  if Z1004=="UKR_1998" &_j==1
replace Q_difficulty_1=54.62  if Z1004=="UKR_1998" &_j==2
replace Q_difficulty_1=37.80  if Z1004=="UKR_1998" &_j==3
replace Q_difficulty_2=0  if Z1004=="UKR_1998" &_j==1
replace Q_difficulty_2=2  if Z1004=="UKR_1998" &_j==2
replace Q_difficulty_2=1  if Z1004=="UKR_1998" &_j==3
replace Q_difficulty_3=13.2  if Z1004=="UKR_1998" &_j==1
replace Q_difficulty_3=2  if Z1004=="UKR_1998" &_j==2
replace Q_difficulty_3=8.514  if Z1004=="UKR_1998" &_j==3
***loads are missing.

replace Q_format=2 if  Z1004=="USA_1996" &_j==1
replace Q_format=2 if  Z1004=="USA_1996" &_j==2
replace Q_format=2 if  Z1004=="USA_1996" &_j==3
replace Q_content=1 if Z1004=="USA_1996" &_j==1
replace Q_content=1 if Z1004=="USA_1996" &_j==2
replace Q_content=1 if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=87.81  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=57.82  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=9.32  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=1  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=1  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=1  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=5.667  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=5.836  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=5.836  if Z1004=="USA_1996" &_j==3


****module 2 
*tab Z1004 if Z1001==2
replace Q_format=2 if  Z1004=="ALB_2005" &_j==1
replace Q_format=1 if  Z1004=="ALB_2005" &_j==2
replace Q_format=2 if  Z1004=="ALB_2005" &_j==3
replace Q_content=1 if Z1004=="ALB_2005" &_j==1
replace Q_content=3 if Z1004=="ALB_2005" &_j==2
replace Q_content=3 if Z1004=="ALB_2005" &_j==3
tab PK if Z1004=="ALB_2005" &_j==1
tab PK if Z1004=="ALB_2005" &_j==2
tab PK if Z1004=="ALB_2005" &_j==3
replace Q_difficulty_1=73.84  if Z1004=="ALB_2005" &_j==1
replace Q_difficulty_1=46.24  if Z1004=="ALB_2005" &_j==2
replace Q_difficulty_1=24.10  if Z1004=="ALB_2005" &_j==3
replace Q_difficulty_2=1  if Z1004=="ALB_2005" &_j==1
replace Q_difficulty_2=0  if Z1004=="ALB_2005" &_j==2
replace Q_difficulty_2=0  if Z1004=="ALB_2005" &_j==3
replace Q_difficulty_3=11.47  if Z1004=="ALB_2005" &_j==1
replace Q_difficulty_3=20  if Z1004=="ALB_2005" &_j==2
replace Q_difficulty_3=11.64  if Z1004=="ALB_2005" &_j==3

replace Q_format=2 if  Z1004=="AUS_2004" &_j==1
replace Q_format=2 if  Z1004=="AUS_2004" &_j==2
replace Q_format=1 if  Z1004=="AUS_2004" &_j==3
replace Q_content=1 if Z1004=="AUS_2004" &_j==1
replace Q_content=2 if Z1004=="AUS_2004" &_j==2
replace Q_content=3 if Z1004=="AUS_2004" &_j==3
tab PK if Z1004=="AUS_2004" &_j==1
tab PK if Z1004=="AUS_2004" &_j==2
tab PK if Z1004=="AUS_2004" &_j==3
replace Q_difficulty_1=78.01  if Z1004=="AUS_2004" &_j==1
replace Q_difficulty_1=64.22  if Z1004=="AUS_2004" &_j==2
replace Q_difficulty_1=41.38  if Z1004=="AUS_2004" &_j==3
replace Q_difficulty_2=1  if Z1004=="AUS_2004" &_j==1
replace Q_difficulty_2=2  if Z1004=="AUS_2004" &_j==2
replace Q_difficulty_2=0  if Z1004=="AUS_2004" &_j==3
replace Q_difficulty_3=16.4  if Z1004=="AUS_2004" &_j==1
replace Q_difficulty_3=16.16  if Z1004=="AUS_2004" &_j==2
replace Q_difficulty_3=7.4  if Z1004=="AUS_2004" &_j==3

replace Q_format=2 if  Z1004=="BEL_2003" &_j==1
replace Q_format=1 if  Z1004=="BEL_2003" &_j==2
replace Q_format=1 if  Z1004=="BEL_2003" &_j==3
replace Q_content=2 if Z1004=="BEL_2003" &_j==1
replace Q_content=3 if Z1004=="BEL_2003" &_j==2
replace Q_content=3 if Z1004=="BEL_2003" &_j==3
tab PK if Z1004=="BEL_2003" &_j==1
tab PK if Z1004=="BEL_2003" &_j==2
tab PK if Z1004=="BEL_2003" &_j==3
replace Q_difficulty_1=80.72  if Z1004=="BEL_2003" &_j==1
replace Q_difficulty_1=43.28  if Z1004=="BEL_2003" &_j==2
replace Q_difficulty_1=13.8  if Z1004=="BEL_2003" &_j==3
replace Q_difficulty_2=2  if Z1004=="BEL_2003" &_j==1
replace Q_difficulty_2=0  if Z1004=="BEL_2003" &_j==2
replace Q_difficulty_2=0  if Z1004=="BEL_2003" &_j==3
replace Q_difficulty_3=4.622  if Z1004=="BEL_2003" &_j==1
replace Q_difficulty_3=3.2  if Z1004=="BEL_2003" &_j==2
replace Q_difficulty_3=11.31  if Z1004=="BEL_2003" &_j==3

replace Q_format=2 if  Z1004=="BRA_2002" &_j==1
replace Q_format=2 if  Z1004=="BRA_2002" &_j==2
replace Q_format=2 if  Z1004=="BRA_2002" &_j==3
replace Q_content=1 if Z1004=="BRA_2002" &_j==1
replace Q_content=1 if Z1004=="BRA_2002" &_j==2
replace Q_content=1 if Z1004=="BRA_2002" &_j==3
tab PK if Z1004=="BRA_2002" &_j==1
tab PK if Z1004=="BRA_2002" &_j==2
tab PK if Z1004=="BRA_2002" &_j==3
replace Q_difficulty_1=66.39  if Z1004=="BRA_2002" &_j==1
replace Q_difficulty_1=51.39  if Z1004=="BRA_2002" &_j==2
replace Q_difficulty_1=31.66  if Z1004=="BRA_2002" &_j==3
replace Q_difficulty_2=1  if Z1004=="BRA_2002" &_j==1
replace Q_difficulty_2=1  if Z1004=="BRA_2002" &_j==2
replace Q_difficulty_2=1  if Z1004=="BRA_2002" &_j==3
replace Q_difficulty_3=.  if Z1004=="BRA_2002" &_j==1
replace Q_difficulty_3=.  if Z1004=="BRA_2002" &_j==2
replace Q_difficulty_3=.  if Z1004=="BRA_2002" &_j==3

replace Q_format=2 if  Z1004=="CAN_2004" &_j==1
replace Q_format=2 if  Z1004=="CAN_2004" &_j==2
replace Q_format=2 if  Z1004=="CAN_2004" &_j==3
replace Q_content=1 if Z1004=="CAN_2004" &_j==1
replace Q_content=5 if Z1004=="CAN_2004" &_j==2
replace Q_content=5 if Z1004=="CAN_2004" &_j==3
tab PK if Z1004=="CAN_2004" &_j==1
tab PK if Z1004=="CAN_2004" &_j==2
tab PK if Z1004=="CAN_2004" &_j==3
replace Q_difficulty_1=65.47  if Z1004=="CAN_2004" &_j==1
replace Q_difficulty_1=46.30  if Z1004=="CAN_2004" &_j==2
replace Q_difficulty_1=29.30  if Z1004=="CAN_2004" &_j==3
replace Q_difficulty_2=1  if Z1004=="CAN_2004" &_j==1
replace Q_difficulty_2=2  if Z1004=="CAN_2004" &_j==2
replace Q_difficulty_2=2  if Z1004=="CAN_2004" &_j==3
replace Q_difficulty_3=11.33  if Z1004=="CAN_2004" &_j==1
replace Q_difficulty_3=9.705  if Z1004=="CAN_2004" &_j==2
replace Q_difficulty_3=8.133  if Z1004=="CAN_2004" &_j==3

replace Q_format=2 if  Z1004=="CHE_2003" &_j==1
replace Q_format=2 if  Z1004=="CHE_2003" &_j==2
replace Q_format=2 if  Z1004=="CHE_2003" &_j==3
replace Q_content=1 if Z1004=="CHE_2003" &_j==1
replace Q_content=3 if Z1004=="CHE_2003" &_j==2
replace Q_content=3 if Z1004=="CHE_2003" &_j==3
tab PK if Z1004=="CHE_2003" &_j==1
tab PK if Z1004=="CHE_2003" &_j==2
tab PK if Z1004=="CHE_2003" &_j==3
replace Q_difficulty_1=81.95  if Z1004=="CHE_2003" &_j==1
replace Q_difficulty_1=35.26  if Z1004=="CHE_2003" &_j==2
replace Q_difficulty_1=30.82  if Z1004=="CHE_2003" &_j==3
replace Q_difficulty_2=1  if Z1004=="CHE_2003" &_j==1
replace Q_difficulty_2=0  if Z1004=="CHE_2003" &_j==2
replace Q_difficulty_2=0  if Z1004=="CHE_2003" &_j==3
replace Q_difficulty_3=12.49  if Z1004=="CHE_2003" &_j==1
replace Q_difficulty_3=14.17  if Z1004=="CHE_2003" &_j==2
replace Q_difficulty_3=8.036  if Z1004=="CHE_2003" &_j==3

replace Q_format=2 if  Z1004=="CHL_2005" &_j==1
replace Q_format=2 if  Z1004=="CHL_2005" &_j==2
replace Q_format=2 if  Z1004=="CHL_2005" &_j==3
replace Q_content=1 if Z1004=="CHL_2005" &_j==1
replace Q_content=1 if Z1004=="CHL_2005" &_j==2
replace Q_content=3 if Z1004=="CHL_2005" &_j==3
tab PK if Z1004=="CHL_2005" &_j==1
tab PK if Z1004=="CHL_2005" &_j==2
tab PK if Z1004=="CHL_2005" &_j==3
replace Q_difficulty_1=92.17  if Z1004=="CHL_2005" &_j==1
replace Q_difficulty_1=85.08  if Z1004=="CHL_2005" &_j==2
replace Q_difficulty_1=29.50  if Z1004=="CHL_2005" &_j==3
replace Q_difficulty_2=1  if Z1004=="CHL_2005" &_j==1
replace Q_difficulty_2=1  if Z1004=="CHL_2005" &_j==2
replace Q_difficulty_2=0  if Z1004=="CHL_2005" &_j==3
replace Q_difficulty_3=16.21  if Z1004=="CHL_2005" &_j==1
replace Q_difficulty_3=13.92  if Z1004=="CHL_2005" &_j==2
replace Q_difficulty_3=8.2  if Z1004=="CHL_2005" &_j==3
***684 missing coded incorrect for diff 1

replace Q_format=1 if  Z1004=="CZE_2002" &_j==1
replace Q_format=1 if  Z1004=="CZE_2002" &_j==2
replace Q_format=1 if  Z1004=="CZE_2002" &_j==3
replace Q_content=3 if Z1004=="CZE_2002" &_j==1
replace Q_content=3 if Z1004=="CZE_2002" &_j==2
replace Q_content=3 if Z1004=="CZE_2002" &_j==3
tab PK if Z1004=="CZE_2002" &_j==1
tab PK if Z1004=="CZE_2002" &_j==2
tab PK if Z1004=="CZE_2002" &_j==3
replace Q_difficulty_1=82.49  if Z1004=="CZE_2002" &_j==1
replace Q_difficulty_1=69.51  if Z1004=="CZE_2002" &_j==2
replace Q_difficulty_1=39.03  if Z1004=="CZE_2002" &_j==3
replace Q_difficulty_2=2  if Z1004=="CZE_2002" &_j==1
replace Q_difficulty_2=2  if Z1004=="CZE_2002" &_j==2
replace Q_difficulty_2=2  if Z1004=="CZE_2002" &_j==3
replace Q_difficulty_3=11.2  if Z1004=="CZE_2002" &_j==1
replace Q_difficulty_3=6.648  if Z1004=="CZE_2002" &_j==2
replace Q_difficulty_3=11.14  if Z1004=="CZE_2002" &_j==3

replace Q_format=2 if  Z1004=="FIN_2003" &_j==1
replace Q_format=1 if  Z1004=="FIN_2003" &_j==2
replace Q_format=1 if  Z1004=="FIN_2003" &_j==3
replace Q_content=2 if Z1004=="FIN_2003" &_j==1
replace Q_content=3 if Z1004=="FIN_2003" &_j==2
replace Q_content=7 if Z1004=="FIN_2003" &_j==3
tab PK if Z1004=="FIN_2003" &_j==1
tab PK if Z1004=="FIN_2003" &_j==2
tab PK if Z1004=="FIN_2003" &_j==3
replace Q_difficulty_1=93.73  if Z1004=="FIN_2003" &_j==1
replace Q_difficulty_1=76.59  if Z1004=="FIN_2003" &_j==2
replace Q_difficulty_1=51.76  if Z1004=="FIN_2003" &_j==3
replace Q_difficulty_2=2  if Z1004=="FIN_2003" &_j==1
replace Q_difficulty_2=0  if Z1004=="FIN_2003" &_j==2
replace Q_difficulty_2=2  if Z1004=="FIN_2003" &_j==3
replace Q_difficulty_3=19.94  if Z1004=="FIN_2003" &_j==1
replace Q_difficulty_3=8.948  if Z1004=="FIN_2003" &_j==2
replace Q_difficulty_3=11.4  if Z1004=="FIN_2003" &_j==3

replace Q_format=2 if  Z1004=="DEU12002" &_j==1
replace Q_format=2 if  Z1004=="DEU12002" &_j==2
replace Q_format=2 if  Z1004=="DEU12002" &_j==3
replace Q_content=1 if Z1004=="DEU12002" &_j==1
replace Q_content=3 if Z1004=="DEU12002" &_j==2
replace Q_content=7 if Z1004=="DEU12002" &_j==3
tab PK if Z1004=="DEU12002" &_j==1
tab PK if Z1004=="DEU12002" &_j==2
tab PK if Z1004=="DEU12002" &_j==3
replace Q_difficulty_1=56.40  if Z1004=="DEU12002" &_j==1
replace Q_difficulty_1=46.05  if Z1004=="DEU12002" &_j==2
replace Q_difficulty_1=11.65  if Z1004=="DEU12002" &_j==3
replace Q_difficulty_2=1  if Z1004=="DEU12002" &_j==1
replace Q_difficulty_2=0  if Z1004=="DEU12002" &_j==2
replace Q_difficulty_2=0  if Z1004=="DEU12002" &_j==3
replace Q_difficulty_3=14.23  if Z1004=="DEU12002" &_j==1
replace Q_difficulty_3=16  if Z1004=="DEU12002" &_j==2
replace Q_difficulty_3=11.67  if Z1004=="DEU12002" &_j==3

replace Q_format=2 if  Z1004=="ESP_2004" &_j==1
replace Q_format=2 if  Z1004=="ESP_2004" &_j==2
replace Q_format=2 if  Z1004=="ESP_2004" &_j==3
replace Q_content=1 if Z1004=="ESP_2004" &_j==1
replace Q_content=3 if Z1004=="ESP_2004" &_j==2
replace Q_content=7 if Z1004=="ESP_2004" &_j==3
tab PK if Z1004=="ESP_2004" &_j==1
tab PK if Z1004=="ESP_2004" &_j==2
tab PK if Z1004=="ESP_2004" &_j==3
replace Q_difficulty_1=69.47  if Z1004=="ESP_2004" &_j==1
replace Q_difficulty_1=40.02  if Z1004=="ESP_2004" &_j==2
replace Q_difficulty_1=30.61  if Z1004=="ESP_2004" &_j==3
replace Q_difficulty_2=1  if Z1004=="ESP_2004" &_j==1
replace Q_difficulty_2=0  if Z1004=="ESP_2004" &_j==2
replace Q_difficulty_2=0  if Z1004=="ESP_2004" &_j==3
replace Q_difficulty_3=16  if Z1004=="ESP_2004" &_j==1
replace Q_difficulty_3=8.2  if Z1004=="ESP_2004" &_j==2
replace Q_difficulty_3=10.30  if Z1004=="ESP_2004" &_j==3

replace Q_format=0 if  Z1004=="FRA_2002" &_j==1
replace Q_format=0 if  Z1004=="FRA_2002" &_j==2
replace Q_format=0 if  Z1004=="FRA_2002" &_j==3
replace Q_content=1 if Z1004=="FRA_2002" &_j==1
replace Q_content=3 if Z1004=="FRA_2002" &_j==2
replace Q_content=6 if Z1004=="FRA_2002" &_j==3
tab PK if Z1004=="FRA_2002" &_j==1
tab PK if Z1004=="FRA_2002" &_j==2
tab PK if Z1004=="FRA_2002" &_j==3
replace Q_difficulty_1=75.20  if Z1004=="FRA_2002" &_j==1
replace Q_difficulty_1=42.2  if Z1004=="FRA_2002" &_j==2
replace Q_difficulty_1=30.20  if Z1004=="FRA_2002" &_j==3
replace Q_difficulty_2=1  if Z1004=="FRA_2002" &_j==1
replace Q_difficulty_2=2  if Z1004=="FRA_2002" &_j==2
replace Q_difficulty_2=1  if Z1004=="FRA_2002" &_j==3
replace Q_difficulty_3=12.49  if Z1004=="FRA_2002" &_j==1
replace Q_difficulty_3=19.94  if Z1004=="FRA_2002" &_j==2
replace Q_difficulty_3=13.2  if Z1004=="FRA_2002" &_j==3

replace Q_format=0 if  Z1004=="GBR_2005" &_j==1
replace Q_format=0 if  Z1004=="GBR_2005" &_j==2
replace Q_format=0 if  Z1004=="GBR_2005" &_j==3
replace Q_content=3 if Z1004=="GBR_2005" &_j==1
replace Q_content=3 if Z1004=="GBR_2005" &_j==2
replace Q_content=3 if Z1004=="GBR_2005" &_j==3
tab PK if Z1004=="GBR_2005" &_j==1
tab PK if Z1004=="GBR_2005" &_j==2
tab PK if Z1004=="GBR_2005" &_j==3
replace Q_difficulty_1=57.56  if Z1004=="GBR_2005" &_j==1
replace Q_difficulty_1=52.67  if Z1004=="GBR_2005" &_j==2
replace Q_difficulty_1=25.23  if Z1004=="GBR_2005" &_j==3
replace Q_difficulty_2=0  if Z1004=="GBR_2005" &_j==1
replace Q_difficulty_2=2  if Z1004=="GBR_2005" &_j==2
replace Q_difficulty_2=2  if Z1004=="GBR_2005" &_j==3
replace Q_difficulty_3=11.67  if Z1004=="GBR_2005" &_j==1
replace Q_difficulty_3=18.2  if Z1004=="GBR_2005" &_j==2
replace Q_difficulty_3=18.2  if Z1004=="GBR_2005" &_j==3

replace Q_format=0 if  Z1004=="HKG_2004" &_j==1
replace Q_format=0 if  Z1004=="HKG_2004" &_j==2
replace Q_format=0 if  Z1004=="HKG_2004" &_j==3
replace Q_content=3 if Z1004=="HKG_2004" &_j==1
replace Q_content=3 if Z1004=="HKG_2004" &_j==2
replace Q_content=3 if Z1004=="HKG_2004" &_j==3
tab PK if Z1004=="HKG_2004" &_j==1
tab PK if Z1004=="HKG_2004" &_j==2
tab PK if Z1004=="HKG_2004" &_j==3
replace Q_difficulty_1=69.59 if Z1004=="HKG_2004" &_j==1
replace Q_difficulty_1=46.05  if Z1004=="HKG_2004" &_j==2
replace Q_difficulty_1=43.47  if Z1004=="HKG_2004" &_j==3
replace Q_difficulty_2=2  if Z1004=="HKG_2004" &_j==1
replace Q_difficulty_2=2  if Z1004=="HKG_2004" &_j==2
replace Q_difficulty_2=0  if Z1004=="HKG_2004" &_j==3
replace Q_difficulty_3=11.31  if Z1004=="HKG_2004" &_j==1
replace Q_difficulty_3=25.61  if Z1004=="HKG_2004" &_j==2
replace Q_difficulty_3=14.8  if Z1004=="HKG_2004" &_j==3

replace Q_format=3 if  Z1004=="HUN_2002" &_j==1
replace Q_format=2 if  Z1004=="HUN_2002" &_j==2
replace Q_format=2 if  Z1004=="HUN_2002" &_j==3
replace Q_content=8 if Z1004=="HUN_2002" &_j==1
replace Q_content=3 if Z1004=="HUN_2002" &_j==2
replace Q_content=1 if Z1004=="HUN_2002" &_j==3
tab PK if Z1004=="HUN_2002" &_j==1
tab PK if Z1004=="HUN_2002" &_j==2
tab PK if Z1004=="HUN_2002" &_j==3
replace Q_difficulty_1=67.33  if Z1004=="HUN_2002" &_j==1
replace Q_difficulty_1=35.17  if Z1004=="HUN_2002" &_j==2
replace Q_difficulty_1=12.92  if Z1004=="HUN_2002" &_j==3
replace Q_difficulty_2=.  if Z1004=="HUN_2002" &_j==1
replace Q_difficulty_2=0  if Z1004=="HUN_2002" &_j==2
replace Q_difficulty_2=1  if Z1004=="HUN_2002" &_j==3
replace Q_difficulty_3=.  if Z1004=="HUN_2002" &_j==1
replace Q_difficulty_3=18.5  if Z1004=="HUN_2002" &_j==2
replace Q_difficulty_3=8.514  if Z1004=="HUN_2002" &_j==3

replace Q_format=2 if  Z1004=="IRL_2002" &_j==1
replace Q_format=2 if  Z1004=="IRL_2002" &_j==2
replace Q_format=2 if  Z1004=="IRL_2002" &_j==3
replace Q_content=1 if Z1004=="IRL_2002" &_j==1
replace Q_content=1 if Z1004=="IRL_2002" &_j==2
replace Q_content=7 if Z1004=="IRL_2002" &_j==3
tab PK if Z1004=="IRL_2002" &_j==1
tab PK if Z1004=="IRL_2002" &_j==2
tab PK if Z1004=="IRL_2002" &_j==3
replace Q_difficulty_1=96.28  if Z1004=="IRL_2002" &_j==1
replace Q_difficulty_1=68.06  if Z1004=="IRL_2002" &_j==2
replace Q_difficulty_1=50.53  if Z1004=="IRL_2002" &_j==3
replace Q_difficulty_2=1  if Z1004=="IRL_2002" &_j==1
replace Q_difficulty_2=1  if Z1004=="IRL_2002" &_j==2
replace Q_difficulty_2=1  if Z1004=="IRL_2002" &_j==3
replace Q_difficulty_3=13.92  if Z1004=="IRL_2002" &_j==1
replace Q_difficulty_3=5.822  if Z1004=="IRL_2002" &_j==2
replace Q_difficulty_3=926  if Z1004=="IRL_2002" &_j==3

replace Q_format=2 if  Z1004=="ISR_2003" &_j==1
replace Q_format=2 if  Z1004=="ISR_2003" &_j==2
replace Q_format=2 if  Z1004=="ISR_2003" &_j==3
replace Q_content=2 if Z1004=="ISR_2003" &_j==1
replace Q_content=1 if Z1004=="ISR_2003" &_j==2
replace Q_content=4 if Z1004=="ISR_2003" &_j==3
tab PK if Z1004=="ISR_2003" &_j==1
tab PK if Z1004=="ISR_2003" &_j==2
tab PK if Z1004=="ISR_2003" &_j==3
replace Q_difficulty_1=93.23  if Z1004=="ISR_2003" &_j==1
replace Q_difficulty_1=66.34  if Z1004=="ISR_2003" &_j==2
replace Q_difficulty_1=31.60  if Z1004=="ISR_2003" &_j==3
replace Q_difficulty_2=2  if Z1004=="ISR_2003" &_j==1
replace Q_difficulty_2=1  if Z1004=="ISR_2003" &_j==2
replace Q_difficulty_2=0  if Z1004=="ISR_2003" &_j==3
replace Q_difficulty_3=8.667  if Z1004=="ISR_2003" &_j==1
replace Q_difficulty_3=5.2  if Z1004=="ISR_2003" &_j==2
replace Q_difficulty_3=8.667  if Z1004=="ISR_2003" &_j==3

replace Q_format=2 if  Z1004=="ITA_2006" &_j==1
replace Q_format=2 if  Z1004=="ITA_2006" &_j==2
replace Q_format=2 if  Z1004=="ITA_2006" &_j==3
replace Q_content=1 if Z1004=="ITA_2006" &_j==1
replace Q_content=1 if Z1004=="ITA_2006" &_j==2
replace Q_content=3 if Z1004=="ITA_2006" &_j==3
tab PK if Z1004=="ITA_2006" &_j==1
tab PK if Z1004=="ITA_2006" &_j==2
tab PK if Z1004=="ITA_2006" &_j==3
replace Q_difficulty_1=78.32  if Z1004=="ITA_2006" &_j==1
replace Q_difficulty_1=73.04  if Z1004=="ITA_2006" &_j==2
replace Q_difficulty_1=39.89  if Z1004=="ITA_2006" &_j==3
replace Q_difficulty_2=1  if Z1004=="ITA_2006" &_j==1
replace Q_difficulty_2=1  if Z1004=="ITA_2006" &_j==2
replace Q_difficulty_2=0  if Z1004=="ITA_2006" &_j==3
replace Q_difficulty_3=11.4  if Z1004=="ITA_2006" &_j==1
replace Q_difficulty_3=11.35  if Z1004=="ITA_2006" &_j==2
replace Q_difficulty_3=14.43  if Z1004=="ITA_2006" &_j==3

replace Q_format=1 if  Z1004=="JPN_2004" &_j==1
replace Q_format=1 if  Z1004=="JPN_2004" &_j==2
replace Q_format=1 if  Z1004=="JPN_2004" &_j==3
replace Q_content=3 if Z1004=="JPN_2004" &_j==1
replace Q_content=3 if Z1004=="JPN_2004" &_j==2
replace Q_content=3 if Z1004=="JPN_2004" &_j==3
tab PK if Z1004=="JPN_2004" &_j==1
tab PK if Z1004=="JPN_2004" &_j==2
tab PK if Z1004=="JPN_2004" &_j==3
replace Q_difficulty_1=37.63  if Z1004=="JPN_2004" &_j==1
replace Q_difficulty_1=36.7  if Z1004=="JPN_2004" &_j==2
replace Q_difficulty_1=22.51  if Z1004=="JPN_2004" &_j==3
replace Q_difficulty_2=0  if Z1004=="JPN_2004" &_j==1
replace Q_difficulty_2=2  if Z1004=="JPN_2004" &_j==2
replace Q_difficulty_2=2  if Z1004=="JPN_2004" &_j==3
replace Q_difficulty_3=14.17  if Z1004=="JPN_2004" &_j==1
replace Q_difficulty_3=11.4  if Z1004=="JPN_2004" &_j==2
replace Q_difficulty_3=11.64  if Z1004=="JPN_2004" &_j==3

replace Q_format=2 if  Z1004=="KGZ_2005" &_j==1
replace Q_format=2 if  Z1004=="KGZ_2005" &_j==2
replace Q_format=2 if  Z1004=="KGZ_2005" &_j==3
replace Q_content=1 if Z1004=="KGZ_2005" &_j==1
replace Q_content=1 if Z1004=="KGZ_2005" &_j==2
replace Q_content=1 if Z1004=="KGZ_2005" &_j==3
tab PK if Z1004=="KGZ_2005" &_j==1
tab PK if Z1004=="KGZ_2005" &_j==2
tab PK if Z1004=="KGZ_2005" &_j==3
replace Q_difficulty_1=75.1  if Z1004=="KGZ_2005" &_j==1
replace Q_difficulty_1=60.1  if Z1004=="KGZ_2005" &_j==2
replace Q_difficulty_1=36.6  if Z1004=="KGZ_2005" &_j==3
replace Q_difficulty_2=1  if Z1004=="KGZ_2005" &_j==1
replace Q_difficulty_2=1  if Z1004=="KGZ_2005" &_j==2
replace Q_difficulty_2=1  if Z1004=="KGZ_2005" &_j==3
replace Q_difficulty_3=15.76  if Z1004=="KGZ_2005" &_j==1
replace Q_difficulty_3=8.2  if Z1004=="KGZ_2005" &_j==2
replace Q_difficulty_3=12  if Z1004=="KGZ_2005" &_j==3

replace Q_format=2 if  Z1004=="KOR_2004" &_j==1
replace Q_format=2 if  Z1004=="KOR_2004" &_j==2
replace Q_format=2 if  Z1004=="KOR_2004" &_j==3
replace Q_content=3 if Z1004=="KOR_2004" &_j==1
replace Q_content=3 if Z1004=="KOR_2004" &_j==2
replace Q_content=1 if Z1004=="KOR_2004" &_j==3
tab PK if Z1004=="KOR_2004" &_j==1
tab PK if Z1004=="KOR_2004" &_j==2
tab PK if Z1004=="KOR_2004" &_j==3
replace Q_difficulty_1=97.47  if Z1004=="KOR_2004" &_j==1
replace Q_difficulty_1=87.07  if Z1004=="KOR_2004" &_j==2
replace Q_difficulty_1=83.27  if Z1004=="KOR_2004" &_j==3
replace Q_difficulty_2=0  if Z1004=="KOR_2004" &_j==1
replace Q_difficulty_2=0  if Z1004=="KOR_2004" &_j==2
replace Q_difficulty_2=1  if Z1004=="KOR_2004" &_j==3
replace Q_difficulty_3=8.277  if Z1004=="KOR_2004" &_j==1
replace Q_difficulty_3=8.277  if Z1004=="KOR_2004" &_j==2
replace Q_difficulty_3=8.2  if Z1004=="KOR_2004" &_j==3

replace Q_format=2 if  Z1004=="MEX_2003" &_j==1
replace Q_format=2 if  Z1004=="MEX_2003" &_j==2
replace Q_format=2 if  Z1004=="MEX_2003" &_j==3
replace Q_content=3 if Z1004=="MEX_2003" &_j==1
replace Q_content=3 if Z1004=="MEX_2003" &_j==2
replace Q_content=1 if Z1004=="MEX_2003" &_j==3
tab PK if Z1004=="MEX_2003" &_j==1
tab PK if Z1004=="MEX_2003" &_j==2
tab PK if Z1004=="MEX_2003" &_j==3
replace Q_difficulty_1=66.65  if Z1004=="MEX_2003" &_j==1
replace Q_difficulty_1=51.93  if Z1004=="MEX_2003" &_j==2
replace Q_difficulty_1=46.86  if Z1004=="MEX_2003" &_j==3
replace Q_difficulty_2=2  if Z1004=="MEX_2003" &_j==1
replace Q_difficulty_2=0  if Z1004=="MEX_2003" &_j==2
replace Q_difficulty_2=1  if Z1004=="MEX_2003" &_j==3
replace Q_difficulty_3=8.514  if Z1004=="MEX_2003" &_j==1
replace Q_difficulty_3=11.67  if Z1004=="MEX_2003" &_j==2
replace Q_difficulty_3=8.133  if Z1004=="MEX_2003" &_j==3

replace Q_format=2 if  Z1004=="NLD_2002" &_j==1
replace Q_format=2 if  Z1004=="NLD_2002" &_j==2
replace Q_format=2 if  Z1004=="NLD_2002" &_j==3
replace Q_content=1 if Z1004=="NLD_2002" &_j==1
replace Q_content=1 if Z1004=="NLD_2002" &_j==2
replace Q_content=1 if Z1004=="NLD_2002" &_j==3
tab PK if Z1004=="NLD_2002" &_j==1
tab PK if Z1004=="NLD_2002" &_j==2
tab PK if Z1004=="NLD_2002" &_j==3
replace Q_difficulty_1=63.6  if Z1004=="NLD_2002" &_j==1
replace Q_difficulty_1=53.62  if Z1004=="NLD_2002" &_j==2
replace Q_difficulty_1=28.34  if Z1004=="NLD_2002" &_j==3
replace Q_difficulty_2=1  if Z1004=="NLD_2002" &_j==1
replace Q_difficulty_2=1  if Z1004=="NLD_2002" &_j==2
replace Q_difficulty_2=1  if Z1004=="NLD_2002" &_j==3
replace Q_difficulty_3=8.514  if Z1004=="NLD_2002" &_j==1
replace Q_difficulty_3=8.514  if Z1004=="NLD_2002" &_j==2
replace Q_difficulty_3=8.514  if Z1004=="NLD_2002" &_j==3

replace Q_format=2 if  Z1004=="NOR_2001" &_j==1
replace Q_format=2 if  Z1004=="NOR_2001" &_j==2
replace Q_format=2 if  Z1004=="NOR_2001" &_j==3
replace Q_content=1 if Z1004=="NOR_2001" &_j==1
replace Q_content=2 if Z1004=="NOR_2001" &_j==2
replace Q_content=1 if Z1004=="NOR_2001" &_j==3
tab PK if Z1004=="NOR_2001" &_j==1
tab PK if Z1004=="NOR_2001" &_j==2
tab PK if Z1004=="NOR_2001" &_j==3
replace Q_difficulty_1=66.57  if Z1004=="NOR_2001" &_j==1
replace Q_difficulty_1=64.23  if Z1004=="NOR_2001" &_j==2
replace Q_difficulty_1=27.1  if Z1004=="NOR_2001" &_j==3
replace Q_difficulty_2=1  if Z1004=="NOR_2001" &_j==1
replace Q_difficulty_2=2  if Z1004=="NOR_2001" &_j==2
replace Q_difficulty_2=1  if Z1004=="NOR_2001" &_j==3
replace Q_difficulty_3=8.133  if Z1004=="NOR_2001" &_j==1
replace Q_difficulty_3=11.51  if Z1004=="NOR_2001" &_j==2
replace Q_difficulty_3=21.4  if Z1004=="NOR_2001" &_j==3

replace Q_format=0 if  Z1004=="NZL_2002" &_j==1
replace Q_format=0 if  Z1004=="NZL_2002" &_j==2
replace Q_format=2 if  Z1004=="NZL_2002" &_j==3
replace Q_content=3 if Z1004=="NZL_2002" &_j==1
replace Q_content=3 if Z1004=="NZL_2002" &_j==2
replace Q_content=2 if Z1004=="NZL_2002" &_j==3
tab PK if Z1004=="NZL_2002" &_j==1
tab PK if Z1004=="NZL_2002" &_j==2
tab PK if Z1004=="NZL_2002" &_j==3
replace Q_difficulty_1=66.34  if Z1004=="NZL_2002" &_j==1
replace Q_difficulty_1=48.99  if Z1004=="NZL_2002" &_j==2
replace Q_difficulty_1=31.25  if Z1004=="NZL_2002" &_j==3
replace Q_difficulty_2=2  if Z1004=="NZL_2002" &_j==1
replace Q_difficulty_2=2  if Z1004=="NZL_2002" &_j==2
replace Q_difficulty_2=2  if Z1004=="NZL_2002" &_j==3
replace Q_difficulty_3=7.349  if Z1004=="NZL_2002" &_j==1
replace Q_difficulty_3=7.095  if Z1004=="NZL_2002" &_j==2
replace Q_difficulty_3=15.08  if Z1004=="NZL_2002" &_j==3

replace Q_format=2 if  Z1004=="PER_2006" &_j==1
replace Q_format=2 if  Z1004=="PER_2006" &_j==2
replace Q_format=2 if  Z1004=="PER_2006" &_j==3
replace Q_content=7 if Z1004=="PER_2006" &_j==1
replace Q_content=3 if Z1004=="PER_2006" &_j==2
replace Q_content=1 if Z1004=="PER_2006" &_j==3
tab PK if Z1004=="PER_2006" &_j==1
tab PK if Z1004=="PER_2006" &_j==2
tab PK if Z1004=="PER_2006" &_j==3
replace Q_difficulty_1=68.75  if Z1004=="PER_2006" &_j==1
replace Q_difficulty_1=40.31  if Z1004=="PER_2006" &_j==2
replace Q_difficulty_1=35.73  if Z1004=="PER_2006" &_j==3
replace Q_difficulty_2=1  if Z1004=="PER_2006" &_j==1
replace Q_difficulty_2=0  if Z1004=="PER_2006" &_j==2
replace Q_difficulty_2=1  if Z1004=="PER_2006" &_j==3
replace Q_difficulty_3=15.73  if Z1004=="PER_2006" &_j==1
replace Q_difficulty_3=16  if Z1004=="PER_2006" &_j==2
replace Q_difficulty_3=16.67  if Z1004=="PER_2006" &_j==3

replace Q_format=2 if  Z1004=="PHL_2004" &_j==1
replace Q_format=1 if  Z1004=="PHL_2004" &_j==2
replace Q_format=2 if  Z1004=="PHL_2004" &_j==3
replace Q_content=3 if Z1004=="PHL_2004" &_j==1
replace Q_content=3 if Z1004=="PHL_2004" &_j==2
replace Q_content=1 if Z1004=="PHL_2004" &_j==3
tab PK if Z1004=="PHL_2004" &_j==1
tab PK if Z1004=="PHL_2004" &_j==2
tab PK if Z1004=="PHL_2004" &_j==3
replace Q_difficulty_1=52.25  if Z1004=="PHL_2004" &_j==1
replace Q_difficulty_1=52.17  if Z1004=="PHL_2004" &_j==2
replace Q_difficulty_1=32.08  if Z1004=="PHL_2004" &_j==3
replace Q_difficulty_2=0  if Z1004=="PHL_2004" &_j==1
replace Q_difficulty_2=2  if Z1004=="PHL_2004" &_j==2
replace Q_difficulty_2=1  if Z1004=="PHL_2004" &_j==3
replace Q_difficulty_3=8.133  if Z1004=="PHL_2004" &_j==1
replace Q_difficulty_3=9.886  if Z1004=="PHL_2004" &_j==2
replace Q_difficulty_3=13.90  if Z1004=="PHL_2004" &_j==3

replace Q_format=2 if  Z1004=="POL_2001" &_j==1
replace Q_format=2 if  Z1004=="POL_2001" &_j==2
replace Q_format=2 if  Z1004=="POL_2001" &_j==3
replace Q_content=7 if Z1004=="POL_2001" &_j==1
replace Q_content=1 if Z1004=="POL_2001" &_j==2
replace Q_content=7 if Z1004=="POL_2001" &_j==3
tab PK if Z1004=="POL_2001" &_j==1
tab PK if Z1004=="POL_2001" &_j==2
tab PK if Z1004=="POL_2001" &_j==3
replace Q_difficulty_1=76.81  if Z1004=="POL_2001" &_j==1
replace Q_difficulty_1=75.31  if Z1004=="POL_2001" &_j==2
replace Q_difficulty_1=74.41  if Z1004=="POL_2001" &_j==3
replace Q_difficulty_2=2  if Z1004=="POL_2001" &_j==1
replace Q_difficulty_2=1  if Z1004=="POL_2001" &_j==2
replace Q_difficulty_2=1  if Z1004=="POL_2001" &_j==3
replace Q_difficulty_3=16  if Z1004=="POL_2001" &_j==1
replace Q_difficulty_3=2.8  if Z1004=="POL_2001" &_j==2
replace Q_difficulty_3=19.94  if Z1004=="POL_2001" &_j==3

replace Q_format=2 if  Z1004=="PRT_2005" &_j==1
replace Q_format=2 if  Z1004=="PRT_2005" &_j==2
replace Q_format=2 if  Z1004=="PRT_2005" &_j==3
replace Q_content=1 if Z1004=="PRT_2005" &_j==1
replace Q_content=2 if Z1004=="PRT_2005" &_j==2
replace Q_content=7 if Z1004=="PRT_2005" &_j==3
tab PK if Z1004=="PRT_2005" &_j==1
tab PK if Z1004=="PRT_2005" &_j==2
tab PK if Z1004=="PRT_2005" &_j==3
replace Q_difficulty_1=73.72  if Z1004=="PRT_2005" &_j==1
replace Q_difficulty_1=71.62  if Z1004=="PRT_2005" &_j==2
replace Q_difficulty_1=31.6  if Z1004=="PRT_2005" &_j==3
replace Q_difficulty_2=1  if Z1004=="PRT_2005" &_j==1
replace Q_difficulty_2=2  if Z1004=="PRT_2005" &_j==2
replace Q_difficulty_2=0  if Z1004=="PRT_2005" &_j==3
replace Q_difficulty_3=15.31  if Z1004=="PRT_2005" &_j==1
replace Q_difficulty_3=13.86  if Z1004=="PRT_2005" &_j==2
replace Q_difficulty_3=14  if Z1004=="PRT_2005" &_j==3

replace Q_format=2 if  Z1004=="ROU_2004" &_j==1
replace Q_format=2 if  Z1004=="ROU_2004" &_j==2
replace Q_format=2 if  Z1004=="ROU_2004" &_j==3
replace Q_content=3 if Z1004=="ROU_2004" &_j==1
replace Q_content=1 if Z1004=="ROU_2004" &_j==2
replace Q_content=3 if Z1004=="ROU_2004" &_j==3
tab PK if Z1004=="ROU_2004" &_j==1
tab PK if Z1004=="ROU_2004" &_j==2
tab PK if Z1004=="ROU_2004" &_j==3
replace Q_difficulty_1=86.36  if Z1004=="ROU_2004" &_j==1
replace Q_difficulty_1=62.15  if Z1004=="ROU_2004" &_j==2
replace Q_difficulty_1=27.65  if Z1004=="ROU_2004" &_j==3
replace Q_difficulty_2=0  if Z1004=="ROU_2004" &_j==1
replace Q_difficulty_2=1  if Z1004=="ROU_2004" &_j==2
replace Q_difficulty_2=0  if Z1004=="ROU_2004" &_j==3
replace Q_difficulty_3=12  if Z1004=="ROU_2004" &_j==1
replace Q_difficulty_3=17.03  if Z1004=="ROU_2004" &_j==2
replace Q_difficulty_3=19.63  if Z1004=="ROU_2004" &_j==3

replace Q_format=2 if  Z1004=="RUS_2004" &_j==1
replace Q_format=2 if  Z1004=="RUS_2004" &_j==2
replace Q_format=2 if  Z1004=="RUS_2004" &_j==3
replace Q_content=2 if Z1004=="RUS_2004" &_j==1
replace Q_content=1 if Z1004=="RUS_2004" &_j==2
replace Q_content=1 if Z1004=="RUS_2004" &_j==3
tab PK if Z1004=="RUS_2004" &_j==1
tab PK if Z1004=="RUS_2004" &_j==2
tab PK if Z1004=="RUS_2004" &_j==3
replace Q_difficulty_1=82.55  if Z1004=="RUS_2004" &_j==1
replace Q_difficulty_1=67.25  if Z1004=="RUS_2004" &_j==2
replace Q_difficulty_1=28.01  if Z1004=="RUS_2004" &_j==3
replace Q_difficulty_2=2  if Z1004=="RUS_2004" &_j==1
replace Q_difficulty_2=1  if Z1004=="RUS_2004" &_j==2
replace Q_difficulty_2=1  if Z1004=="RUS_2004" &_j==3
replace Q_difficulty_3=14.8  if Z1004=="RUS_2004" &_j==1
replace Q_difficulty_3=12  if Z1004=="RUS_2004" &_j==2
replace Q_difficulty_3=8.2  if Z1004=="RUS_2004" &_j==3

replace Q_format=2 if  Z1004=="SVN_2004" &_j==1
replace Q_format=2 if  Z1004=="SVN_2004" &_j==2
replace Q_format=2 if  Z1004=="SVN_2004" &_j==3
replace Q_content=1 if Z1004=="SVN_2004" &_j==1
replace Q_content=7 if Z1004=="SVN_2004" &_j==2
replace Q_content=3 if Z1004=="SVN_2004" &_j==3
tab PK if Z1004=="SVN_2004" &_j==1
tab PK if Z1004=="SVN_2004" &_j==2
tab PK if Z1004=="SVN_2004" &_j==3
replace Q_difficulty_1=57.09  if Z1004=="SVN_2004" &_j==1
replace Q_difficulty_1=33.72  if Z1004=="SVN_2004" &_j==2
replace Q_difficulty_1=26.85  if Z1004=="SVN_2004" &_j==3
replace Q_difficulty_2=1  if Z1004=="SVN_2004" &_j==1
replace Q_difficulty_2=0  if Z1004=="SVN_2004" &_j==2
replace Q_difficulty_2=0  if Z1004=="SVN_2004" &_j==3
replace Q_difficulty_3=8.044  if Z1004=="SVN_2004" &_j==1
replace Q_difficulty_3=8.036  if Z1004=="SVN_2004" &_j==2
replace Q_difficulty_3=20.58  if Z1004=="SVN_2004" &_j==3
***gunning fog calculated on a more approximate translation.

replace Q_format=0 if  Z1004=="SWE_2002" &_j==1
replace Q_format=0 if  Z1004=="SWE_2002" &_j==2
replace Q_format=0 if  Z1004=="SWE_2002" &_j==3
replace Q_content=4 if Z1004=="SWE_2002" &_j==1
replace Q_content=4 if Z1004=="SWE_2002" &_j==2
replace Q_content=4 if Z1004=="SWE_2002" &_j==3
tab PK if Z1004=="SWE_2002" &_j==1
tab PK if Z1004=="SWE_2002" &_j==2
tab PK if Z1004=="SWE_2002" &_j==3
replace Q_difficulty_1=71.60  if Z1004=="SWE_2002" &_j==1
replace Q_difficulty_1=72.64  if Z1004=="SWE_2002" &_j==2
replace Q_difficulty_1=30.47  if Z1004=="SWE_2002" &_j==3
replace Q_difficulty_2=0  if Z1004=="SWE_2002" &_j==1
replace Q_difficulty_2=0  if Z1004=="SWE_2002" &_j==2
replace Q_difficulty_2=0  if Z1004=="SWE_2002" &_j==3
replace Q_difficulty_3=8.36  if Z1004=="SWE_2002" &_j==1
replace Q_difficulty_3=8  if Z1004=="SWE_2002" &_j==2
replace Q_difficulty_3=11.31  if Z1004=="SWE_2002" &_j==3

replace Q_format=2 if  Z1004=="TWN_2001" &_j==1
replace Q_format=2 if  Z1004=="TWN_2001" &_j==2
replace Q_format=2 if  Z1004=="TWN_2001" &_j==3
replace Q_content=1 if Z1004=="TWN_2001" &_j==1
replace Q_content=1 if Z1004=="TWN_2001" &_j==2
replace Q_content=3 if Z1004=="TWN_2001" &_j==3
tab PK if Z1004=="TWN_2001" &_j==1
tab PK if Z1004=="TWN_2001" &_j==2
tab PK if Z1004=="TWN_2001" &_j==3
replace Q_difficulty_1=94.11  if Z1004=="TWN_2001" &_j==1
replace Q_difficulty_1=72.75  if Z1004=="TWN_2001" &_j==2
replace Q_difficulty_1=27.6  if Z1004=="TWN_2001" &_j==3
replace Q_difficulty_2=1  if Z1004=="TWN_2001" &_j==1
replace Q_difficulty_2=1  if Z1004=="TWN_2001" &_j==2
replace Q_difficulty_2=0  if Z1004=="TWN_2001" &_j==3
replace Q_difficulty_3=9.067  if Z1004=="TWN_2001" &_j==1
replace Q_difficulty_3=8.514  if Z1004=="TWN_2001" &_j==2
replace Q_difficulty_3=8.514  if Z1004=="TWN_2001" &_j==3

replace Q_format=2 if  Z1004=="TWN_2004" &_j==1
replace Q_format=2 if  Z1004=="TWN_2004" &_j==2
replace Q_format=2 if  Z1004=="TWN_2004" &_j==3
replace Q_content=7 if Z1004=="TWN_2004" &_j==1
replace Q_content=3 if Z1004=="TWN_2004" &_j==2
replace Q_content=3 if Z1004=="TWN_2004" &_j==3
tab PK if Z1004=="TWN_2004" &_j==1
tab PK if Z1004=="TWN_2004" &_j==2
tab PK if Z1004=="TWN_2004" &_j==3
replace Q_difficulty_1=79.98  if Z1004=="TWN_2004" &_j==1
replace Q_difficulty_1=28.80  if Z1004=="TWN_2004" &_j==2
replace Q_difficulty_1=21.39  if Z1004=="TWN_2004" &_j==3
replace Q_difficulty_2=1  if Z1004=="TWN_2004" &_j==1
replace Q_difficulty_2=2  if Z1004=="TWN_2004" &_j==2
replace Q_difficulty_2=0  if Z1004=="TWN_2004" &_j==3
replace Q_difficulty_3=8.044  if Z1004=="TWN_2004" &_j==1
replace Q_difficulty_3=12.49  if Z1004=="TWN_2004" &_j==2
replace Q_difficulty_3=8.2  if Z1004=="TWN_2004" &_j==3

replace Q_format=2 if  Z1004=="USA_2004" &_j==1
replace Q_format=2 if  Z1004=="USA_2004" &_j==2
replace Q_format=2 if  Z1004=="USA_2004" &_j==3
replace Q_content=1 if Z1004=="USA_2004" &_j==1
replace Q_content=7 if Z1004=="USA_2004" &_j==2
replace Q_content=1 if Z1004=="USA_2004" &_j==3
tab PK if Z1004=="USA_2004" &_j==1
tab PK if Z1004=="USA_2004" &_j==2
tab PK if Z1004=="USA_2004" &_j==3
replace Q_difficulty_1=86.02  if Z1004=="USA_2004" &_j==1
replace Q_difficulty_1=64.92  if Z1004=="USA_2004" &_j==2
replace Q_difficulty_1=31.14  if Z1004=="USA_2004" &_j==3
replace Q_difficulty_2=1  if Z1004=="USA_2004" &_j==1
replace Q_difficulty_2=1  if Z1004=="USA_2004" &_j==2
replace Q_difficulty_2=1  if Z1004=="USA_2004" &_j==3
replace Q_difficulty_3=5.836  if Z1004=="USA_2004" &_j==1
replace Q_difficulty_3=5.836  if Z1004=="USA_2004" &_j==2
replace Q_difficulty_3=13.11  if Z1004=="USA_2004" &_j==3

***Module 3
*tab Z1004 if Z1001==3

replace Q_format=0 if  Z1004=="AUS_2007" &_j==1
replace Q_format=0 if  Z1004=="AUS_2007" &_j==2
replace Q_format=0 if  Z1004=="AUS_2007" &_j==3
replace Q_content=3 if Z1004=="AUS_2007" &_j==1
replace Q_content=3 if Z1004=="AUS_2007" &_j==2
replace Q_content=3 if Z1004=="AUS_2007" &_j==3
tab PK if Z1004=="AUS_2007" &_j==1
tab PK if Z1004=="AUS_2007" &_j==2
tab PK if Z1004=="AUS_2007" &_j==3
replace Q_difficulty_1=74.75  if Z1004=="AUS_2007" &_j==1
replace Q_difficulty_1=56.81  if Z1004=="AUS_2007" &_j==2
replace Q_difficulty_1=26.86  if Z1004=="AUS_2007" &_j==3
replace Q_difficulty_2=0  if Z1004=="AUS_2007" &_j==1
replace Q_difficulty_2=0  if Z1004=="AUS_2007" &_j==2
replace Q_difficulty_2=2  if Z1004=="AUS_2007" &_j==3
replace Q_difficulty_3=9.914  if Z1004=="AUS_2007" &_j==1
replace Q_difficulty_3=11.33  if Z1004=="AUS_2007" &_j==2
replace Q_difficulty_3=11.35  if Z1004=="AUS_2007" &_j==3

replace Q_format=1 if  Z1004=="AUT_2008" &_j==1
replace Q_format=1 if  Z1004=="AUT_2008" &_j==2
replace Q_format=1 if  Z1004=="AUT_2008" &_j==3
replace Q_content=5 if Z1004=="AUT_2008" &_j==1
replace Q_content=5 if Z1004=="AUT_2008" &_j==2
replace Q_content=5 if Z1004=="AUT_2008" &_j==3
tab PK if Z1004=="AUT_2008" &_j==1
tab PK if Z1004=="AUT_2008" &_j==2
tab PK if Z1004=="AUT_2008" &_j==3
replace Q_difficulty_1=79.91  if Z1004=="AUT_2008" &_j==1
replace Q_difficulty_1=51.07  if Z1004=="AUT_2008" &_j==2
replace Q_difficulty_1=49.36  if Z1004=="AUT_2008" &_j==3
replace Q_difficulty_2=2  if Z1004=="AUT_2008" &_j==1
replace Q_difficulty_2=2  if Z1004=="AUT_2008" &_j==2
replace Q_difficulty_2=2  if Z1004=="AUT_2008" &_j==3
replace Q_difficulty_3=8.781  if Z1004=="AUT_2008" &_j==1
replace Q_difficulty_3=8.781  if Z1004=="AUT_2008" &_j==2
replace Q_difficulty_3=8.781  if Z1004=="AUT_2008" &_j==3

replace Q_format=0 if  Z1004=="BRA_2006" &_j==1
replace Q_format=0 if  Z1004=="BRA_2006" &_j==2
replace Q_format=0 if  Z1004=="BRA_2006" &_j==3
replace Q_content=3 if Z1004=="BRA_2006" &_j==1
replace Q_content=2 if Z1004=="BRA_2006" &_j==2
replace Q_content=3 if Z1004=="BRA_2006" &_j==3
tab PK if Z1004=="BRA_2006" &_j==1
tab PK if Z1004=="BRA_2006" &_j==2
tab PK if Z1004=="BRA_2006" &_j==3
replace Q_difficulty_1=87.5  if Z1004=="BRA_2006" &_j==1
replace Q_difficulty_1=58.6  if Z1004=="BRA_2006" &_j==2
replace Q_difficulty_1=30.20  if Z1004=="BRA_2006" &_j==3
replace Q_difficulty_2=0  if Z1004=="BRA_2006" &_j==1
replace Q_difficulty_2=1  if Z1004=="BRA_2006" &_j==2
replace Q_difficulty_2=2  if Z1004=="BRA_2006" &_j==3
replace Q_difficulty_3=8.514  if Z1004=="BRA_2006" &_j==1
replace Q_difficulty_3=9.067  if Z1004=="BRA_2006" &_j==2
replace Q_difficulty_3=12.49  if Z1004=="BRA_2006" &_j==3

replace Q_format=0 if  Z1004=="BRA_2010" &_j==1
replace Q_format=0 if  Z1004=="BRA_2010" &_j==2
replace Q_format=0 if  Z1004=="BRA_2010" &_j==3
replace Q_content=3 if Z1004=="BRA_2010" &_j==1
replace Q_content=2 if Z1004=="BRA_2010" &_j==2
replace Q_content=3 if Z1004=="BRA_2010" &_j==3
tab PK if Z1004=="BRA_2010" &_j==1
tab PK if Z1004=="BRA_2010" &_j==2
tab PK if Z1004=="BRA_2010" &_j==3
replace Q_difficulty_1=93.35  if Z1004=="BRA_2010" &_j==1
replace Q_difficulty_1=32.45  if Z1004=="BRA_2010" &_j==2
replace Q_difficulty_1=17.10  if Z1004=="BRA_2010" &_j==3
replace Q_difficulty_2=0  if Z1004=="BRA_2010" &_j==1
replace Q_difficulty_2=1  if Z1004=="BRA_2010" &_j==2
replace Q_difficulty_2=2  if Z1004=="BRA_2010" &_j==3
replace Q_difficulty_3=8.514  if Z1004=="BRA_2010" &_j==1
replace Q_difficulty_3=9.067  if Z1004=="BRA_2010" &_j==2
replace Q_difficulty_3=12.49  if Z1004=="BRA_2010" &_j==3

replace Q_format=2 if  Z1004=="CAN_2008" &_j==1
replace Q_format=2 if  Z1004=="CAN_2008" &_j==2
replace Q_format=2 if  Z1004=="CAN_2008" &_j==3
replace Q_content=1 if Z1004=="CAN_2008" &_j==1
replace Q_content=7 if Z1004=="CAN_2008" &_j==2
replace Q_content=1 if Z1004=="CAN_2008" &_j==3
tab PK if Z1004=="CAN_2008" &_j==1
tab PK if Z1004=="CAN_2008" &_j==2
tab PK if Z1004=="CAN_2008" &_j==3
replace Q_difficulty_1=50.06  if Z1004=="CAN_2008" &_j==1
replace Q_difficulty_1=35.80  if Z1004=="CAN_2008" &_j==2
replace Q_difficulty_1=18.18  if Z1004=="CAN_2008" &_j==3
replace Q_difficulty_2=1  if Z1004=="CAN_2008" &_j==1
replace Q_difficulty_2=1  if Z1004=="CAN_2008" &_j==2
replace Q_difficulty_2=1  if Z1004=="CAN_2008" &_j==3
replace Q_difficulty_3=8.277  if Z1004=="CAN_2008" &_j==1
replace Q_difficulty_3=11.33  if Z1004=="CAN_2008" &_j==2
replace Q_difficulty_3=16.4  if Z1004=="CAN_2008" &_j==3

replace Q_format=2 if  Z1004=="CHE_2007" &_j==1
replace Q_format=2 if  Z1004=="CHE_2007" &_j==2
replace Q_format=2 if  Z1004=="CHE_2007" &_j==3
replace Q_content=1 if Z1004=="CHE_2007" &_j==1
replace Q_content=2 if Z1004=="CHE_2007" &_j==2
replace Q_content=3 if Z1004=="CHE_2007" &_j==3
tab PK if Z1004=="CHE_2007" &_j==1
tab PK if Z1004=="CHE_2007" &_j==2
tab PK if Z1004=="CHE_2007" &_j==3
replace Q_difficulty_1=74.84  if Z1004=="CHE_2007" &_j==1
replace Q_difficulty_1=54042  if Z1004=="CHE_2007" &_j==2
replace Q_difficulty_1=38.27  if Z1004=="CHE_2007" &_j==3
replace Q_difficulty_2=1  if Z1004=="CHE_2007" &_j==1
replace Q_difficulty_2=0  if Z1004=="CHE_2007" &_j==2
replace Q_difficulty_2=0  if Z1004=="CHE_2007" &_j==3
replace Q_difficulty_3=12  if Z1004=="CHE_2007" &_j==1
replace Q_difficulty_3=16.93  if Z1004=="CHE_2007" &_j==2
replace Q_difficulty_3=21.38  if Z1004=="CHE_2007" &_j==3

replace Q_format=2 if  Z1004=="CHL_2009" &_j==1
replace Q_format=2 if  Z1004=="CHL_2009" &_j==2
replace Q_format=. if  Z1004=="CHL_2009" &_j==3
replace Q_content=3 if Z1004=="CHL_2009" &_j==1
replace Q_content=3 if Z1004=="CHL_2009" &_j==2
replace Q_content=. if Z1004=="CHL_2009" &_j==3
tab PK if Z1004=="CHL_2009" &_j==1
tab PK if Z1004=="CHL_2009" &_j==2
tab PK if Z1004=="CHL_2009" &_j==3
replace Q_difficulty_1=49.25  if Z1004=="CHL_2009" &_j==1
replace Q_difficulty_1=47.50  if Z1004=="CHL_2009" &_j==2
replace Q_difficulty_1=.  if Z1004=="CHL_2009" &_j==3
replace Q_difficulty_2=2  if Z1004=="CHL_2009" &_j==1
replace Q_difficulty_2=0  if Z1004=="CHL_2009" &_j==2
replace Q_difficulty_2=.  if Z1004=="CHL_2009" &_j==3
replace Q_difficulty_3=9.067  if Z1004=="CHL_2009" &_j==1
replace Q_difficulty_3=11.67  if Z1004=="CHL_2009" &_j==2
replace Q_difficulty_3=.  if Z1004=="CHL_2009" &_j==3
***no third item_question!

replace Q_format=0 if  Z1004=="CZE_2006" &_j==1
replace Q_format=0 if  Z1004=="CZE_2006" &_j==2
replace Q_format=0 if  Z1004=="CZE_2006" &_j==3
replace Q_content=3 if Z1004=="CZE_2006" &_j==1
replace Q_content=7 if Z1004=="CZE_2006" &_j==2
replace Q_content=3 if Z1004=="CZE_2006" &_j==3
tab PK if Z1004=="CZE_2006" &_j==1
tab PK if Z1004=="CZE_2006" &_j==2
tab PK if Z1004=="CZE_2006" &_j==3
replace Q_difficulty_1=74.33  if Z1004=="CZE_2006" &_j==1
replace Q_difficulty_1=57.04  if Z1004=="CZE_2006" &_j==2
replace Q_difficulty_1=38.14  if Z1004=="CZE_2006" &_j==3
replace Q_difficulty_2=2  if Z1004=="CZE_2006" &_j==1
replace Q_difficulty_2=0  if Z1004=="CZE_2006" &_j==2
replace Q_difficulty_2=2  if Z1004=="CZE_2006" &_j==3
replace Q_difficulty_3=11.64  if Z1004=="CZE_2006" &_j==1
replace Q_difficulty_3=2.8  if Z1004=="CZE_2006" &_j==2
replace Q_difficulty_3=17.03  if Z1004=="CZE_2006" &_j==3

replace Q_format=0 if  Z1004=="CZE_2010" &_j==1
replace Q_format=0 if  Z1004=="CZE_2010" &_j==2
replace Q_format=0 if  Z1004=="CZE_2010" &_j==3
replace Q_content=3 if Z1004=="CZE_2010" &_j==1
replace Q_content=3 if Z1004=="CZE_2010" &_j==2
replace Q_content=7 if Z1004=="CZE_2010" &_j==3
tab PK if Z1004=="CZE_2010" &_j==1
tab PK if Z1004=="CZE_2010" &_j==2
tab PK if Z1004=="CZE_2010" &_j==3
replace Q_difficulty_1=79.81  if Z1004=="CZE_2010" &_j==1
replace Q_difficulty_1=30.86  if Z1004=="CZE_2010" &_j==2
replace Q_difficulty_1=26.60  if Z1004=="CZE_2010" &_j==3
replace Q_difficulty_2=2  if Z1004=="CZE_2010" &_j==1
replace Q_difficulty_2=2  if Z1004=="CZE_2010" &_j==2
replace Q_difficulty_2=0  if Z1004=="CZE_2010" &_j==3
replace Q_difficulty_3=11.64  if Z1004=="CZE_2010" &_j==1
replace Q_difficulty_3=17.03  if Z1004=="CZE_2010" &_j==2
replace Q_difficulty_3=2.8  if Z1004=="CZE_2010" &_j==3

replace Q_format=2 if  Z1004=="DEU_2005" &_j==1
replace Q_format=2 if  Z1004=="DEU_2005" &_j==2
replace Q_format=2 if  Z1004=="DEU_2005" &_j==3
replace Q_content=5 if Z1004=="DEU_2005" &_j==1
replace Q_content=5 if Z1004=="DEU_2005" &_j==2
replace Q_content=5 if Z1004=="DEU_2005" &_j==3
tab PK if Z1004=="DEU_2005" &_j==1
tab PK if Z1004=="DEU_2005" &_j==2
tab PK if Z1004=="DEU_2005" &_j==3
replace Q_difficulty_1=60.60  if Z1004=="DEU_2005" &_j==1
replace Q_difficulty_1=30.67  if Z1004=="DEU_2005" &_j==2
replace Q_difficulty_1= 35.08 if Z1004=="DEU_2005" &_j==3
replace Q_difficulty_2=2  if Z1004=="DEU_2005" &_j==1
replace Q_difficulty_2=2  if Z1004=="DEU_2005" &_j==2
replace Q_difficulty_2=2  if Z1004=="DEU_2005" &_j==3
replace Q_difficulty_3=16.01  if Z1004=="DEU_2005" &_j==1
replace Q_difficulty_3=8.363  if Z1004=="DEU_2005" &_j==2
replace Q_difficulty_3=8  if Z1004=="DEU_2005" &_j==3

replace Q_format=2 if  Z1004=="DEU_2009" &_j==1
replace Q_format=2 if  Z1004=="DEU_2009" &_j==2
replace Q_format=2 if  Z1004=="DEU_2009" &_j==3
replace Q_content=3 if Z1004=="DEU_2009" &_j==1
replace Q_content=3 if Z1004=="DEU_2009" &_j==2
replace Q_content=7 if Z1004=="DEU_2009" &_j==3
tab PK if Z1004=="DEU_2009" &_j==1
tab PK if Z1004=="DEU_2009" &_j==2
tab PK if Z1004=="DEU_2009" &_j==3
replace Q_difficulty_1=69.16  if Z1004=="DEU_2009" &_j==1
replace Q_difficulty_1=59.19  if Z1004=="DEU_2009" &_j==2
replace Q_difficulty_1=26.30  if Z1004=="DEU_2009" &_j==3
replace Q_difficulty_2=0  if Z1004=="DEU_2009" &_j==1
replace Q_difficulty_2=0  if Z1004=="DEU_2009" &_j==2
replace Q_difficulty_2=2  if Z1004=="DEU_2009" &_j==3
replace Q_difficulty_3=16.02  if Z1004=="DEU_2009" &_j==1
replace Q_difficulty_3=13.9  if Z1004=="DEU_2009" &_j==2
replace Q_difficulty_3=16.4  if Z1004=="DEU_2009" &_j==3

replace Q_format=2 if  Z1004=="DNK_2007" &_j==1
replace Q_format=2 if  Z1004=="DNK_2007" &_j==2
replace Q_format=1 if  Z1004=="DNK_2007" &_j==3
replace Q_content=2 if Z1004=="DNK_2007" &_j==1
replace Q_content=3 if Z1004=="DNK_2007" &_j==2
replace Q_content=4 if Z1004=="DNK_2007" &_j==3
tab PK if Z1004=="DNK_2007" &_j==1
tab PK if Z1004=="DNK_2007" &_j==2
tab PK if Z1004=="DNK_2007" &_j==3
replace Q_difficulty_1=55.96  if Z1004=="DNK_2007" &_j==1
replace Q_difficulty_1=37.45  if Z1004=="DNK_2007" &_j==2
replace Q_difficulty_1=27.74  if Z1004=="DNK_2007" &_j==3
replace Q_difficulty_2=2  if Z1004=="DNK_2007" &_j==1
replace Q_difficulty_2=0  if Z1004=="DNK_2007" &_j==2
replace Q_difficulty_2=2  if Z1004=="DNK_2007" &_j==3
replace Q_difficulty_3=9.2  if Z1004=="DNK_2007" &_j==1
replace Q_difficulty_3=9.705  if Z1004=="DNK_2007" &_j==2
replace Q_difficulty_3=6.467  if Z1004=="DNK_2007" &_j==3

replace Q_format=. if  Z1004=="ESP_2008" &_j==1
replace Q_format=1 if  Z1004=="ESP_2008" &_j==2
replace Q_format=2 if  Z1004=="ESP_2008" &_j==3
replace Q_content=. if Z1004=="ESP_2008" &_j==1
replace Q_content=5 if Z1004=="ESP_2008" &_j==2
replace Q_content=4 if Z1004=="ESP_2008" &_j==3
tab PK if Z1004=="ESP_2008" &_j==1
tab PK if Z1004=="ESP_2008" &_j==2
tab PK if Z1004=="ESP_2008" &_j==3
replace Q_difficulty_1=.  if Z1004=="ESP_2008" &_j==1
replace Q_difficulty_1=50.66  if Z1004=="ESP_2008" &_j==2
replace Q_difficulty_1=23.34  if Z1004=="ESP_2008" &_j==3
replace Q_difficulty_2=.  if Z1004=="ESP_2008" &_j==1
replace Q_difficulty_2=2  if Z1004=="ESP_2008" &_j==2
replace Q_difficulty_2=0  if Z1004=="ESP_2008" &_j==3
replace Q_difficulty_3=.  if Z1004=="ESP_2008" &_j==1
replace Q_difficulty_3=21.17  if Z1004=="ESP_2008" &_j==2
replace Q_difficulty_3=14.42  if Z1004=="ESP_2008" &_j==3

replace Q_format=2 if  Z1004=="EST_2011" &_j==1
replace Q_format=2 if  Z1004=="EST_2011" &_j==2
replace Q_format=2 if  Z1004=="EST_2011" &_j==3
replace Q_content=3 if Z1004=="EST_2011" &_j==1
replace Q_content=3 if Z1004=="EST_2011" &_j==2
replace Q_content=3 if Z1004=="EST_2011" &_j==3
tab PK if Z1004=="EST_2011" &_j==1
tab PK if Z1004=="EST_2011" &_j==2
tab PK if Z1004=="EST_2011" &_j==3
replace Q_difficulty_1=84.40  if Z1004=="EST_2011" &_j==1
replace Q_difficulty_1=53.30  if Z1004=="EST_2011" &_j==2
replace Q_difficulty_1=40.60  if Z1004=="EST_2011" &_j==3
replace Q_difficulty_2=0  if Z1004=="EST_2011" &_j==1
replace Q_difficulty_2=1  if Z1004=="EST_2011" &_j==2
replace Q_difficulty_2=0  if Z1004=="EST_2011" &_j==3
replace Q_difficulty_3=11.47  if Z1004=="EST_2011" &_j==1
replace Q_difficulty_3=11.35  if Z1004=="EST_2011" &_j==2
replace Q_difficulty_3=11.31  if Z1004=="EST_2011" &_j==3

replace Q_format=2 if  Z1004=="FIN_2007" &_j==1
replace Q_format=2 if  Z1004=="FIN_2007" &_j==2
replace Q_format=2 if  Z1004=="FIN_2007" &_j==3
replace Q_content=3 if Z1004=="FIN_2007" &_j==1
replace Q_content=2 if Z1004=="FIN_2007" &_j==2
replace Q_content=3 if Z1004=="FIN_2007" &_j==3
tab PK if Z1004=="FIN_2007" &_j==1
tab PK if Z1004=="FIN_2007" &_j==2
tab PK if Z1004=="FIN_2007" &_j==3
replace Q_difficulty_1=89.01  if Z1004=="FIN_2007" &_j==1
replace Q_difficulty_1=77.63  if Z1004=="FIN_2007" &_j==2
replace Q_difficulty_1=42.79  if Z1004=="FIN_2007" &_j==3
replace Q_difficulty_2=2  if Z1004=="FIN_2007" &_j==1
replace Q_difficulty_2=2  if Z1004=="FIN_2007" &_j==2
replace Q_difficulty_2=2  if Z1004=="FIN_2007" &_j==3
replace Q_difficulty_3=16.93  if Z1004=="FIN_2007" &_j==1
replace Q_difficulty_3=9.153  if Z1004=="FIN_2007" &_j==2
replace Q_difficulty_3=15.31  if Z1004=="FIN_2007" &_j==3

replace Q_format=1 if  Z1004=="FIN_2011" &_j==1
replace Q_format=1 if  Z1004=="FIN_2011" &_j==2
replace Q_format=1 if  Z1004=="FIN_2011" &_j==3
replace Q_content=1 if Z1004=="FIN_2011" &_j==1
replace Q_content=3 if Z1004=="FIN_2011" &_j==2
replace Q_content=7 if Z1004=="FIN_2011" &_j==3
tab PK if Z1004=="FIN_2011" &_j==1
tab PK if Z1004=="FIN_2011" &_j==2
tab PK if Z1004=="FIN_2011" &_j==3
replace Q_difficulty_1=91.53  if Z1004=="FIN_2011" &_j==1
replace Q_difficulty_1=66.10  if Z1004=="FIN_2011" &_j==2
replace Q_difficulty_1=36.52  if Z1004=="FIN_2011" &_j==3
replace Q_difficulty_2=1  if Z1004=="FIN_2011" &_j==1
replace Q_difficulty_2=2  if Z1004=="FIN_2011" &_j==2
replace Q_difficulty_2=2  if Z1004=="FIN_2011" &_j==3
replace Q_difficulty_3=9.817  if Z1004=="FIN_2011" &_j==1
replace Q_difficulty_3=13.15  if Z1004=="FIN_2011" &_j==2
replace Q_difficulty_3=17.56  if Z1004=="FIN_2011" &_j==3

replace Q_format=0 if  Z1004=="FRA_2007" &_j==1
replace Q_format=0 if  Z1004=="FRA_2007" &_j==2
replace Q_format=0 if  Z1004=="FRA_2007" &_j==3
replace Q_content=3 if Z1004=="FRA_2007" &_j==1
replace Q_content=3 if Z1004=="FRA_2007" &_j==2
replace Q_content=6 if Z1004=="FRA_2007" &_j==3
tab PK if Z1004=="FRA_2007" &_j==1
tab PK if Z1004=="FRA_2007" &_j==2
tab PK if Z1004=="FRA_2007" &_j==3
replace Q_difficulty_1=87.55  if Z1004=="FRA_2007" &_j==1
replace Q_difficulty_1=72.05  if Z1004=="FRA_2007" &_j==2
replace Q_difficulty_1=38.90  if Z1004=="FRA_2007" &_j==3
replace Q_difficulty_2=2  if Z1004=="FRA_2007" &_j==1
replace Q_difficulty_2=2  if Z1004=="FRA_2007" &_j==2
replace Q_difficulty_2=1  if Z1004=="FRA_2007" &_j==3
replace Q_difficulty_3=18.20  if Z1004=="FRA_2007" &_j==1
replace Q_difficulty_3=19.94  if Z1004=="FRA_2007" &_j==2
replace Q_difficulty_3=13.2  if Z1004=="FRA_2007" &_j==3

replace Q_format=2 if  Z1004=="GRC_2009" &_j==1
replace Q_format=2 if  Z1004=="GRC_2009" &_j==2
replace Q_format=2 if  Z1004=="GRC_2009" &_j==3
replace Q_content=2 if Z1004=="GRC_2009" &_j==1
replace Q_content=3 if Z1004=="GRC_2009" &_j==2
replace Q_content=3 if Z1004=="GRC_2009" &_j==3
tab PK if Z1004=="GRC_2009" &_j==1
tab PK if Z1004=="GRC_2009" &_j==2
tab PK if Z1004=="GRC_2009" &_j==3
replace Q_difficulty_1=63.21  if Z1004=="GRC_2009" &_j==1
replace Q_difficulty_1=50  if Z1004=="GRC_2009" &_j==2
replace Q_difficulty_1=41.98  if Z1004=="GRC_2009" &_j==3
replace Q_difficulty_2=0  if Z1004=="GRC_2009" &_j==1
replace Q_difficulty_2=0  if Z1004=="GRC_2009" &_j==2
replace Q_difficulty_2=0  if Z1004=="GRC_2009" &_j==3
replace Q_difficulty_3=11.47  if Z1004=="GRC_2009" &_j==1
replace Q_difficulty_3=11.35  if Z1004=="GRC_2009" &_j==2
replace Q_difficulty_3=17.92  if Z1004=="GRC_2009" &_j==3

replace Q_format=0 if  Z1004=="HGK_2008" &_j==1
replace Q_format=0 if  Z1004=="HGK_2008" &_j==2
replace Q_format=0 if  Z1004=="HGK_2008" &_j==3
replace Q_content=3 if Z1004=="HGK_2008" &_j==1
replace Q_content=3 if Z1004=="HGK_2008" &_j==2
replace Q_content=3 if Z1004=="HGK_2008" &_j==3
tab PK if Z1004=="HGK_2008" &_j==1
tab PK if Z1004=="HGK_2008" &_j==2
tab PK if Z1004=="HGK_2008" &_j==3
replace Q_difficulty_1=60.25  if Z1004=="HGK_2008" &_j==1
replace Q_difficulty_1=49.33  if Z1004=="HGK_2008" &_j==2
replace Q_difficulty_1=20  if Z1004=="HGK_2008" &_j==3
replace Q_difficulty_2=2  if Z1004=="HGK_2008" &_j==1
replace Q_difficulty_2=2  if Z1004=="HGK_2008" &_j==2
replace Q_difficulty_2=2  if Z1004=="HGK_2008" &_j==3
replace Q_difficulty_3=14  if Z1004=="HGK_2008" &_j==1
replace Q_difficulty_3=23.2  if Z1004=="HGK_2008" &_j==2
replace Q_difficulty_3=9.8  if Z1004=="HGK_2008" &_j==3

replace Q_format=2 if  Z1004=="HRV_2007" &_j==1
replace Q_format=2 if  Z1004=="HRV_2007" &_j==2
replace Q_format=2 if  Z1004=="HRV_2007" &_j==3
replace Q_content=1 if Z1004=="HRV_2007" &_j==1
replace Q_content=3 if Z1004=="HRV_2007" &_j==2
replace Q_content=3 if Z1004=="HRV_2007" &_j==3
tab PK if Z1004=="HRV_2007" &_j==1
tab PK if Z1004=="HRV_2007" &_j==2
tab PK if Z1004=="HRV_2007" &_j==3
replace Q_difficulty_1=81.87  if Z1004=="HRV_2007" &_j==1
replace Q_difficulty_1=55.18  if Z1004=="HRV_2007" &_j==2
replace Q_difficulty_1=35.36  if Z1004=="HRV_2007" &_j==3
replace Q_difficulty_2=1  if Z1004=="HRV_2007" &_j==1
replace Q_difficulty_2=0  if Z1004=="HRV_2007" &_j==2
replace Q_difficulty_2=0  if Z1004=="HRV_2007" &_j==3
replace Q_difficulty_3=10.96  if Z1004=="HRV_2007" &_j==1
replace Q_difficulty_3=12.49  if Z1004=="HRV_2007" &_j==2
replace Q_difficulty_3=10.88  if Z1004=="HRV_2007" &_j==3

replace Q_format=2 if  Z1004=="IRL_2007" &_j==1
replace Q_format=2 if  Z1004=="IRL_2007" &_j==2
replace Q_format=2 if  Z1004=="IRL_2007" &_j==3
replace Q_content=1 if Z1004=="IRL_2007" &_j==1
replace Q_content=4 if Z1004=="IRL_2007" &_j==2
replace Q_content=2 if Z1004=="IRL_2007" &_j==3
tab PK if Z1004=="IRL_2007" &_j==1
tab PK if Z1004=="IRL_2007" &_j==2
tab PK if Z1004=="IRL_2007" &_j==3
replace Q_difficulty_1=71.92  if Z1004=="IRL_2007" &_j==1
replace Q_difficulty_1=50.38  if Z1004=="IRL_2007" &_j==2
replace Q_difficulty_1=19.72  if Z1004=="IRL_2007" &_j==3
replace Q_difficulty_2=1  if Z1004=="IRL_2007" &_j==1
replace Q_difficulty_2=2  if Z1004=="IRL_2007" &_j==2
replace Q_difficulty_2=2  if Z1004=="IRL_2007" &_j==3
replace Q_difficulty_3=8.667  if Z1004=="IRL_2007" &_j==1
replace Q_difficulty_3=11.67  if Z1004=="IRL_2007" &_j==2
replace Q_difficulty_3=8  if Z1004=="IRL_2007" &_j==3

replace Q_format=2 if  Z1004=="ISL_2007" &_j==1
replace Q_format=2 if  Z1004=="ISL_2007" &_j==2
replace Q_format=2 if  Z1004=="ISL_2007" &_j==3
replace Q_content=6 if Z1004=="ISL_2007" &_j==1
replace Q_content=1 if Z1004=="ISL_2007" &_j==2
replace Q_content=3 if Z1004=="ISL_2007" &_j==3
tab PK if Z1004=="ISL_2007" &_j==1
tab PK if Z1004=="ISL_2007" &_j==2
tab PK if Z1004=="ISL_2007" &_j==3
replace Q_difficulty_1=74.67  if Z1004=="ISL_2007" &_j==1
replace Q_difficulty_1=63.89  if Z1004=="ISL_2007" &_j==2
replace Q_difficulty_1=26.77  if Z1004=="ISL_2007" &_j==3
replace Q_difficulty_2=1  if Z1004=="ISL_2007" &_j==1
replace Q_difficulty_2=1  if Z1004=="ISL_2007" &_j==2
replace Q_difficulty_2=0  if Z1004=="ISL_2007" &_j==3
replace Q_difficulty_3=8.044  if Z1004=="ISL_2007" &_j==1
replace Q_difficulty_3=11.47  if Z1004=="ISL_2007" &_j==2
replace Q_difficulty_3=11.47  if Z1004=="ISL_2007" &_j==3

replace Q_format=2 if  Z1004=="ISL_2009" &_j==1
replace Q_format=2 if  Z1004=="ISL_2009" &_j==2
replace Q_format=2 if  Z1004=="ISL_2009" &_j==3
replace Q_content=1 if Z1004=="ISL_2009" &_j==1
replace Q_content=3 if Z1004=="ISL_2009" &_j==2
replace Q_content=1 if Z1004=="ISL_2009" &_j==3
tab PK if Z1004=="ISL_2009" &_j==1
tab PK if Z1004=="ISL_2009" &_j==2
tab PK if Z1004=="ISL_2009" &_j==3
replace Q_difficulty_1=77.26  if Z1004=="ISL_2009" &_j==1
replace Q_difficulty_1=72.56  if Z1004=="ISL_2009" &_j==2
replace Q_difficulty_1=25.85  if Z1004=="ISL_2009" &_j==3
replace Q_difficulty_2=2  if Z1004=="ISL_2009" &_j==1
replace Q_difficulty_2=1  if Z1004=="ISL_2009" &_j==2
replace Q_difficulty_2=0  if Z1004=="ISL_2009" &_j==3
replace Q_difficulty_3=8.044  if Z1004=="ISL_2009" &_j==1
replace Q_difficulty_3=11.47  if Z1004=="ISL_2009" &_j==2
replace Q_difficulty_3=11.47  if Z1004=="ISL_2009" &_j==3

replace Q_format=2 if  Z1004=="ISR_2006" &_j==1
replace Q_format=2 if  Z1004=="ISR_2006" &_j==2
replace Q_format=2 if  Z1004=="ISR_2006" &_j==3
replace Q_content=2 if Z1004=="ISR_2006" &_j==1
replace Q_content=1 if Z1004=="ISR_2006" &_j==2
replace Q_content=4 if Z1004=="ISR_2006" &_j==3
tab PK if Z1004=="ISR_2006" &_j==1
tab PK if Z1004=="ISR_2006" &_j==2
tab PK if Z1004=="ISR_2006" &_j==3
replace Q_difficulty_1=65.83  if Z1004=="ISR_2006" &_j==1
replace Q_difficulty_1=64.17  if Z1004=="ISR_2006" &_j==2
replace Q_difficulty_1=37.08  if Z1004=="ISR_2006" &_j==3
replace Q_difficulty_2=2  if Z1004=="ISR_2006" &_j==1
replace Q_difficulty_2=1  if Z1004=="ISR_2006" &_j==2
replace Q_difficulty_2=0  if Z1004=="ISR_2006" &_j==3
replace Q_difficulty_3=8.667  if Z1004=="ISR_2006" &_j==1
replace Q_difficulty_3=5.2  if Z1004=="ISR_2006" &_j==2
replace Q_difficulty_3=8.667  if Z1004=="ISR_2006" &_j==3

replace Q_format=1 if  Z1004=="JPN_2007" &_j==1
replace Q_format=1 if  Z1004=="JPN_2007" &_j==2
replace Q_format=1 if  Z1004=="JPN_2007" &_j==3
replace Q_content=3 if Z1004=="JPN_2007" &_j==1
replace Q_content=3 if Z1004=="JPN_2007" &_j==2
replace Q_content=3 if Z1004=="JPN_2007" &_j==3
tab PK if Z1004=="JPN_2007" &_j==1
tab PK if Z1004=="JPN_2007" &_j==2
tab PK if Z1004=="JPN_2007" &_j==3
replace Q_difficulty_1=43.34  if Z1004=="JPN_2007" &_j==1
replace Q_difficulty_1=40.42  if Z1004=="JPN_2007" &_j==2
replace Q_difficulty_1=20.62  if Z1004=="JPN_2007" &_j==3
replace Q_difficulty_2=2  if Z1004=="JPN_2007" &_j==1
replace Q_difficulty_2=0  if Z1004=="JPN_2007" &_j==2
replace Q_difficulty_2=2  if Z1004=="JPN_2007" &_j==3
replace Q_difficulty_3=11.4  if Z1004=="JPN_2007" &_j==1
replace Q_difficulty_3=14.17  if Z1004=="JPN_2007" &_j==2
replace Q_difficulty_3=11.64  if Z1004=="JPN_2007" &_j==3

***AM HERE 19 to go.

generate item265_q1_KOR_2008= C3036_1b if Z1004=="KOR_2008"
tab item265_q1_KOR_2008
generate item266_q2_KOR_2008= C3036_2b if Z1004=="KOR_2008"
tab item266_q2_KOR_2008
generate item267_q3_KOR_2008= C3036_3b if Z1004=="KOR_2008"
tab item267_q3_KOR_2008


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item268_q1_LVA_2010= C3036_1b if Z1004=="LVA_2010"
tab item268_q1_LVA_2010
generate item269_q2_LVA_2010= C3036_2b if Z1004=="LVA_2010"
tab item269_q2_LVA_2010
generate item270_q3_LVA_2010= C3036_3b if Z1004=="LVA_2010"
tab item270_q3_LVA_2010


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item271_q1_MEX_2006= C3036_1b if Z1004=="MEX_2006"
tab item271_q1_MEX_2006
generate item272_q2_MEX_2006= C3036_2b if Z1004=="MEX_2006"
tab item272_q2_MEX_2006
generate item273_q3_MEX_2006= C3036_3b if Z1004=="MEX_2006"
tab item273_q3_MEX_2006


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item274_q1_MEX_2009= C3036_1b if Z1004=="MEX_2009"
tab item274_q1_MEX_2009
generate item275_q2_MEX_2009= C3036_2b if Z1004=="MEX_2009"
tab item275_q2_MEX_2009
generate item276_q3_MEX_2009= C3036_3b if Z1004=="MEX_2009"
tab item276_q3_MEX_2009


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item277_q1_NLD_2006= C3036_1b if Z1004=="NLD_2006"
tab item277_q1_NLD_2006
generate item278_q2_NLD_2006= C3036_2b if Z1004=="NLD_2006"
tab item278_q2_NLD_2006
generate item279_q3_NLD_2006= C3036_3b if Z1004=="NLD_2006"
tab item279_q3_NLD_2006


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item280_q1_NLD_2010= C3036_1b if Z1004=="NLD_2010"
tab item280_q1_NLD_2010
generate item281_q2_NLD_2010= C3036_2b if Z1004=="NLD_2010"
tab item281_q2_NLD_2010
generate item282_q3_NLD_2010= C3036_3b if Z1004=="NLD_2010"
tab item282_q3_NLD_2010


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item283_q1_NOR_2005= C3036_1b if Z1004=="NOR_2005"
tab item283_q1_NOR_2005
generate item284_q2_NOR_2005= C3036_2b if Z1004=="NOR_2005"
tab item284_q2_NOR_2005
generate item285_q3_NOR_2005= C3036_3b if Z1004=="NOR_2005"
tab item285_q3_NOR_2005


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item286_q1_NOR_2009= C3036_1b if Z1004=="NOR_2009"
tab item286_q1_NOR_2009
generate item287_q2_NOR_2009= C3036_2b if Z1004=="NOR_2009"
tab item287_q2_NOR_2009
generate item288_q3_NOR_2009= C3036_3b if Z1004=="NOR_2009"
tab item288_q3_NOR_2009


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item289_q1_NZL_2008= C3036_1b if Z1004=="NZL_2008"
tab item289_q1_NZL_2008
generate item290_q2_NZL_2008= C3036_2b if Z1004=="NZL_2008"
tab item290_q2_NZL_2008
generate item291_q3_NZL_2008= C3036_3b if Z1004=="NZL_2008"
tab item291_q3_NZL_2008
***first item loses 300 cases +


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item292_q1_PER_2011= C3036_1b if Z1004=="PER_2011"
tab item292_q1_PER_2011
generate item293_q2_PER_2011= C3036_2b if Z1004=="PER_2011"
tab item293_q2_PER_2011
generate item294_q3_PER_2011= C3036_3b if Z1004=="PER_2011"
tab item294_q3_PER_2011


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item295_q1_PHL_2010= C3036_1b if Z1004=="PHL_2010"
tab item295_q1_PHL_2010
generate item296_q2_PHL_2010= C3036_2b if Z1004=="PHL_2010"
tab item296_q2_PHL_2010
generate item297_q3_PHL_2010= C3036_3b if Z1004=="PHL_2010"
tab item297_q3_PHL_2010


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item298_q1_POL_2005= C3036_1b if Z1004=="POL_2005"
tab item298_q1_POL_2005
generate item299_q2_POL_2005= C3036_2b if Z1004=="POL_2005"
tab item299_q2_POL_2005
generate item300_q3_POL_2005= C3036_3b if Z1004=="POL_2005"
tab item300_q3_POL_2005



replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item301_q1_POL_2007= C3036_1b if Z1004=="POL_2007"
tab item301_q1_POL_2007
generate item302_q2_POL_2007= C3036_2b if Z1004=="POL_2007"
tab item302_q2_POL_2007
generate item303_q3_POL_2007= C3036_3b if Z1004=="POL_2007"
tab item303_q3_POL_2007


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item304_q1_PRT_2009= C3036_1b if Z1004=="PRT_2009"
tab item304_q1_PRT_2009
drop if item304_q1_PRT_2009==.
generate item305_q2_PRT_2009= C3036_2b if Z1004=="PRT_2009"
tab item305_q2_PRT_2009
drop if item305_q2_PRT_2009==.
generate item306_q3_PRT_2009= C3036_3b if Z1004=="PRT_2009"
tab item306_q3_PRT_2009
*** 400 cases loss between 1 2 3 


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item307_q1_ROM_2009= C3036_1b if Z1004=="ROM_2009"
tab item307_q1_ROM_2009
generate item308_q2_ROM_2009= C3036_2b if Z1004=="ROM_2009"
tab item308_q2_ROM_2009
generate item309_q3_ROM_2009= C3036_3b if Z1004=="ROM_2009"
tab item309_q3_ROM_2009


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item310_q1_SVK_2010= C3036_1b if Z1004=="SVK_2010"
tab item310_q1_SVK_2010
generate item311_q2_SVK_2010= C3036_2b if Z1004=="SVK_2010"
tab item311_q2_SVK_2010
generate item312_q3_SVK_2010= C3036_3b if Z1004=="SVK_2010"
tab item312_q3_SVK_2010


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item313_q1_SWE_2006= C3036_1b if Z1004=="SWE_2006"
tab item313_q1_SWE_2006
generate item314_q2_SWE_2006= C3036_2b if Z1004=="SWE_2006"
tab item314_q2_SWE_2006
generate item315_q3_SWE_2006= C3036_3b if Z1004=="SWE_2006"
tab item315_q3_SWE_2006



replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item316_q1_THA_2007= C3036_1b if Z1004=="THA_2007"
tab item316_q1_THA_2007
generate item317_q2_THA_2007= C3036_2b if Z1004=="THA_2007"
tab item317_q2_THA_2007
generate item318_q3_THA_2007= C3036_3b if Z1004=="THA_2007"
tab item318_q3_THA_2007


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

generate item319_q1_TWN_2008= C3036_1b if Z1004=="TWN_2008"
tab item319_q1_TWN_2008
generate item320_q2_TWN_2008= C3036_2b if Z1004=="TWN_2008"
tab item320_q2_TWN_2008
generate item321_q3_TWN_2008= C3036_3b if Z1004=="TWN_2008"
tab item321_q3_TWN_2008


replace Q_format= if  Z1004=="USA_1996" &_j==1
replace Q_format= if  Z1004=="USA_1996" &_j==2
replace Q_format= if  Z1004=="USA_1996" &_j==3
replace Q_content= if Z1004=="USA_1996" &_j==1
replace Q_content= if Z1004=="USA_1996" &_j==2
replace Q_content= if Z1004=="USA_1996" &_j==3
tab PK if Z1004=="USA_1996" &_j==1
tab PK if Z1004=="USA_1996" &_j==2
tab PK if Z1004=="USA_1996" &_j==3
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_1=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_2=  if Z1004=="USA_1996" &_j==3
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==1
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==2
replace Q_difficulty_3=  if Z1004=="USA_1996" &_j==3

replace Q_format=2 if  Z1004=="USA_2008" &_j==1
replace Q_format=2 if  Z1004=="USA_2008" &_j==2
replace Q_format=2 if  Z1004=="USA_2008" &_j==3
replace Q_content=1 if Z1004=="USA_2008" &_j==1
replace Q_content=1 if Z1004=="USA_2008" &_j==2
replace Q_content=1 if Z1004=="USA_2008" &_j==3
tab PK if Z1004=="USA_2008" &_j==1
tab PK if Z1004=="USA_2008" &_j==2
tab PK if Z1004=="USA_2008" &_j==3
replace Q_difficulty_1=67.07  if Z1004=="USA_2008" &_j==1
replace Q_difficulty_1=41.82  if Z1004=="USA_2008" &_j==2
replace Q_difficulty_1=12.23  if Z1004=="USA_2008" &_j==3
replace Q_difficulty_2=1  if Z1004=="USA_2008" &_j==1
replace Q_difficulty_2=1  if Z1004=="USA_2008" &_j==2
replace Q_difficulty_2=1  if Z1004=="USA_2008" &_j==3
replace Q_difficulty_3=5.836  if Z1004=="USA_2008" &_j==1
replace Q_difficulty_3=5.836  if Z1004=="USA_2008" &_j==2
replace Q_difficulty_3=5.836  if Z1004=="USA_2008" &_j==3

replace Q_format=2 if  Z1004=="ZAF_2009" &_j==1
replace Q_format=2 if  Z1004=="ZAF_2009" &_j==2
replace Q_format=2 if  Z1004=="ZAF_2009" &_j==3
replace Q_content=1 if Z1004=="ZAF_2009" &_j==1
replace Q_content=1 if Z1004=="ZAF_2009" &_j==2
replace Q_content=1 if Z1004=="ZAF_2009" &_j==3
tab PK if Z1004=="ZAF_2009" &_j==1
tab PK if Z1004=="ZAF_2009" &_j==2
tab PK if Z1004=="ZAF_2009" &_j==3
replace Q_difficulty_1=62.75  if Z1004=="ZAF_2009" &_j==1
replace Q_difficulty_1=41.50  if Z1004=="ZAF_2009" &_j==2
replace Q_difficulty_1=15.50  if Z1004=="ZAF_2009" &_j==3
replace Q_difficulty_2=1  if Z1004=="ZAF_2009" &_j==1
replace Q_difficulty_2=1  if Z1004=="ZAF_2009" &_j==2
replace Q_difficulty_2=1  if Z1004=="ZAF_2009" &_j==3
replace Q_difficulty_3=16.93  if Z1004=="ZAF_2009" &_j==1
replace Q_difficulty_3=12  if Z1004=="ZAF_2009" &_j==2
replace Q_difficulty_3=12  if Z1004=="ZAF_2009" &_j==3


***overal difficulty? series of dummies?
generate Q_difficulty_4=2
replace Q_difficulty_4 =3 if Q_difficulty_1>90
replace Q_difficulty_4 =1 if Q_difficulty_1<35
label variable Q_difficulty_4 "Question diffucilty ordinal"
*label define diff2 1 "Very Hard" 2 "Middle pack" 3 "Very Easy" 
label values Q_difficulty_4 diff2
